From 479c8328b4ef0aec5efd3667d2a96e977eb321fc Mon Sep 17 00:00:00 2001 From: TheYoingLad <105537918+TheYoingLad@users.noreply.github.com> Date: Sat, 4 Oct 2025 14:24:54 +0200 Subject: [PATCH] Added the ability for the farming station to plant Pam's nether seeds (#208) Co-authored-by: Martin Robertz --- dependencies.gradle | 1 + src/main/java/crazypants/enderio/EnderIO.java | 1 + .../machine/farm/farmers/PlantableFarmer.java | 30 +++++++++++++++---- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index 53f618d8..51dc187b 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -27,4 +27,5 @@ dependencies { compileOnly(rfg.deobf('maven.modrinth:immibis-microblocks:59.1.2')) // https://modrinth.com/mod/immibis-microblocks/version/59.1.2 compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-beta56:api') {transitive = false} + compileOnly("com.github.GTNewHorizons:Hodgepodge:2.7.2:dev") } diff --git a/src/main/java/crazypants/enderio/EnderIO.java b/src/main/java/crazypants/enderio/EnderIO.java index b6e60681..df6c7b4a 100644 --- a/src/main/java/crazypants/enderio/EnderIO.java +++ b/src/main/java/crazypants/enderio/EnderIO.java @@ -213,6 +213,7 @@ public class EnderIO { public static final boolean hasLwjgl3 = Loader.isModLoaded("lwjgl3ify"); public static final boolean hasGT5 = Loader.isModLoaded("gregtech") && !Loader.isModLoaded("gregapi"); + public static final boolean hasHP = Loader.isModLoaded("hodgepodge"); // Materials public static ItemCapacitor itemBasicCapacitor; diff --git a/src/main/java/crazypants/enderio/machine/farm/farmers/PlantableFarmer.java b/src/main/java/crazypants/enderio/machine/farm/farmers/PlantableFarmer.java index 4d765b96..9e8347ed 100644 --- a/src/main/java/crazypants/enderio/machine/farm/farmers/PlantableFarmer.java +++ b/src/main/java/crazypants/enderio/machine/farm/farmers/PlantableFarmer.java @@ -17,7 +17,9 @@ import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.util.ForgeDirection; import com.enderio.core.common.util.BlockCoord; +import com.mitchej123.hodgepodge.mixins.interfaces.INetherSeed; +import crazypants.enderio.EnderIO; import crazypants.enderio.machine.farm.TileFarmStation; public class PlantableFarmer implements IFarmerJoe { @@ -109,7 +111,13 @@ public class PlantableFarmer implements IFarmerJoe { protected boolean plant(TileFarmStation farm, World worldObj, BlockCoord bc, IPlantable plantable) { worldObj.setBlock(bc.x, bc.y, bc.z, Blocks.air, 0, 1 | 2); - Block target = plantable.getPlant(null, 0, 0, 0); + Block target; + // needed for Pam's nether seeds + if (EnderIO.hasHP && plantable instanceof INetherSeed netherSeed) { + target = netherSeed.hodgepodge$getPlant(null, 0, 0, 0); + } else { + target = plantable.getPlant(null, 0, 0, 0); + } int meta = plantable.getPlantMetadata(null, 0, 0, 0); worldObj.setBlock(bc.x, bc.y, bc.z, target, meta, 1 | 2); farm.actionPerformed(false); @@ -117,7 +125,13 @@ public class PlantableFarmer implements IFarmerJoe { } protected boolean canPlant(World worldObj, BlockCoord bc, IPlantable plantable) { - Block target = plantable.getPlant(null, 0, 0, 0); + Block target; + // needed for Pam's nether seeds + if (EnderIO.hasHP && plantable instanceof INetherSeed netherSeed) { + target = netherSeed.hodgepodge$getPlant(null, 0, 0, 0); + } else { + target = plantable.getPlant(null, 0, 0, 0); + } Block ground = worldObj.getBlock(bc.x, bc.y - 1, bc.z); if (target != null && target.canPlaceBlockAt(worldObj, bc.x, bc.y, bc.z) && target.canBlockStay(worldObj, bc.x, bc.y, bc.z) @@ -182,10 +196,14 @@ public class PlantableFarmer implements IFarmerJoe { } private boolean isPlantableForBlock(ItemStack stack, Block block) { - if (!(stack.getItem() instanceof IPlantable)) { - return false; + if (stack.getItem() instanceof IPlantable plantable) { + // needed for Pam's nether seeds + if (EnderIO.hasHP && plantable instanceof INetherSeed netherSeed) { + return netherSeed.hodgepodge$getPlant(null, 0, 0, 0) == block; + } else { + return plantable.getPlant(null, 0, 0, 0) == block; + } } - IPlantable plantable = (IPlantable) stack.getItem(); - return plantable.getPlant(null, 0, 0, 0) == block; + return false; } }