-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix sweared plants drop on place nearby sweared plants
- it's more a dirty fix, but it actually works - could be improved in the future
- Loading branch information
1 parent
346d5cb
commit 66dcd83
Showing
4 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/java/de/pilz/plantmegapackfix/mixins/late/PMPBlockPlantMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package de.pilz.plantmegapackfix.mixins.late; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraft.world.World; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import com.llamalad7.mixinextras.sugar.Local; | ||
|
||
import plantmegapack.block.PMPBlockPlant; | ||
import plantmegapack.common.PMPPlantGrowthType; | ||
|
||
@Mixin(PMPBlockPlant.class) | ||
public abstract class PMPBlockPlantMixin { | ||
|
||
@ModifyExpressionValue( | ||
method = "onNeighborBlockChange", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lplantmegapack/block/PMPBlockPlant;canBlockStay(Lnet/minecraft/world/World;III)Z"), | ||
remap = false) | ||
private boolean pmpfix$onNeighborBlockChange$ignoreSweared(boolean original, World world, int x, int y, int z, | ||
@Local Block block) { | ||
return original || (block instanceof PMPBlockPlant | ||
&& ((PMPBlockPlant) block).plantData.attributes.growthType == PMPPlantGrowthType.SEAWEED); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/de/pilz/plantmegapackfix/mixins/late/PMPGenAquaticMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package de.pilz.plantmegapackfix.mixins.late; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraft.world.World; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; | ||
|
||
import plantmegapack.block.PMPBlockPlant; | ||
import plantmegapack.worldgen.PMPGenAquatic; | ||
|
||
@Mixin(PMPGenAquatic.class) | ||
public abstract class PMPGenAquaticMixin { | ||
|
||
@WrapWithCondition( | ||
method = "spawnRandomSeaweedCluster", | ||
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;setBlock(IIILnet/minecraft/block/Block;II)Z"), | ||
remap = false) | ||
private static boolean pmpfix$spawnRandomSeaweedCluster$checkForWaterAbove(World world, int x, int y, int z, | ||
Block blockIn, int metadataIn, int flags) { | ||
PMPBlockPlant plant = (PMPBlockPlant) blockIn; | ||
if (!plant.canPlaceBlockAt(world, x, y, z)) return false; | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters