From b2fc48c99c0b2c9e7de549ab94fdc8d761b55376 Mon Sep 17 00:00:00 2001 From: Ruben Taelman Date: Thu, 3 Oct 2024 17:26:37 +0200 Subject: [PATCH] Fix JEI ghosts items not working for lists in the LP Closes CyclopsMC/IntegratedDynamics#1398 --- .../LogicProgrammerGhostIngredientHandler.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/cyclops/integrateddynamicscompat/modcompat/jei/logicprogrammer/LogicProgrammerGhostIngredientHandler.java b/src/main/java/org/cyclops/integrateddynamicscompat/modcompat/jei/logicprogrammer/LogicProgrammerGhostIngredientHandler.java index c77b2fbb..2b36cb8f 100644 --- a/src/main/java/org/cyclops/integrateddynamicscompat/modcompat/jei/logicprogrammer/LogicProgrammerGhostIngredientHandler.java +++ b/src/main/java/org/cyclops/integrateddynamicscompat/modcompat/jei/logicprogrammer/LogicProgrammerGhostIngredientHandler.java @@ -10,7 +10,6 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandlerItem; import org.apache.commons.compress.utils.Lists; -import org.apache.commons.lang3.tuple.Pair; import org.cyclops.cyclopscore.helper.GuiHelpers; import org.cyclops.integrateddynamics.api.logicprogrammer.ILogicProgrammerElement; import org.cyclops.integrateddynamics.client.gui.container.ContainerScreenLogicProgrammerBase; @@ -47,9 +46,9 @@ public List> getTargets(T screen, I ingredient, boolean doStart) { if (itemStack != null) { // Determine slots in which the stack could be placed - Pair[] slotPositions = element.getRenderPattern().getSlotPositions(); - for (int slot = 0; slot < slotPositions.length; slot++) { - int slotId = container.slots.size() - 36 - slotPositions.length + slot; + int slotPositionsCount = container.slots.size() - 36 - 4; /* subtract player inv, and 4 fixed slots in LP */ + for (int slot = 0; slot < slotPositionsCount; slot++) { + int slotId = container.slots.size() - 36 - slotPositionsCount + slot; Slot slotContainer = container.getSlot(slotId); Rect2i bounds = new Rect2i( @@ -92,8 +91,8 @@ public boolean shouldHighlightTargets() { protected void setStackInSlot(T screen, int slot, ItemStack itemStack) { ContainerLogicProgrammerBase container = screen.getMenu(); - Pair[] slotPositions = container.getActiveElement().getRenderPattern().getSlotPositions(); - int slotId = container.slots.size() - 36 - slotPositions.length + slot; + int slotPositionsCount = container.slots.size() - 36 - 4; /* subtract player inv, and 4 fixed slots in LP */ + int slotId = container.slots.size() - 36 - slotPositionsCount + slot; container.setItem(slotId, 0, itemStack.copy()); IntegratedDynamicsCompat._instance.getPacketHandler().sendToServer( new CPacketSetSlot(container.containerId, slotId, itemStack));