From e9cf83bc03914fcc14d45219be4b5d89ac1c05dc Mon Sep 17 00:00:00 2001 From: ByThePowerOfScience <16433721+ByThePowerOfScience@users.noreply.github.com> Date: Mon, 11 Apr 2022 15:38:16 -0400 Subject: [PATCH] Add AgriCraft Compat to PlantInteractor Changed it so the Plant Interactor will take AgriCraft crops directly into its inventory, removing the HORRENDOUS lag caused by large AgriCraft farms in modpacks. This fix is already implemented in the Divine Journey 2 modpack via Mixin. --- .../tile/agriculture/PlantInteractorTile.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/buuz135/industrial/tile/agriculture/PlantInteractorTile.java b/src/main/java/com/buuz135/industrial/tile/agriculture/PlantInteractorTile.java index 301927868..455c89ecb 100644 --- a/src/main/java/com/buuz135/industrial/tile/agriculture/PlantInteractorTile.java +++ b/src/main/java/com/buuz135/industrial/tile/agriculture/PlantInteractorTile.java @@ -48,6 +48,9 @@ import net.ndrei.teslacorelib.inventory.BoundingRectangle; import net.ndrei.teslacorelib.inventory.FluidTankType; +import com.infinityraider.agricraft.api.v1.misc.IAgriHarvestable; +import net.minecraft.tileentity.TileEntity; + import java.util.ArrayList; import java.util.List; @@ -86,6 +89,13 @@ public float work() { BlockPos tempPos = new BlockPos(pointerPos.getX(), pointerPos.getY() + i, pointerPos.getZ()); if (!BlockUtils.canBlockBeBroken(this.world, tempPos)) continue; IBlockState tempState = this.world.getBlockState(tempPos); + TileEntity te = world.getTileEntity(tempPos); + if (te instanceof IAgriHarvestable) { + WORKING_TILES.add(this); + ((IAgriHarvestable)te).onHarvest(stack -> ItemHandlerHelper.insertItem(outItems, stack, false), null); + WORKING_TILES.remove(this); + continue; + } if (tempState.getBlock() instanceof IPlantable || tempState.getBlock() instanceof IGrowable) { FakePlayer player = IndustrialForegoing.getFakePlayer(this.world, tempPos.up()); player.inventory.clear();