Skip to content

Commit

Permalink
Fix JEI ghosts items not working for lists in the LP
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Oct 3, 2024
1 parent 2eed029 commit b2fc48c
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -47,9 +46,9 @@ public <I> List<Target<I>> getTargets(T screen, I ingredient, boolean doStart) {

if (itemStack != null) {
// Determine slots in which the stack could be placed
Pair<Integer, Integer>[] 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(
Expand Down Expand Up @@ -92,8 +91,8 @@ public boolean shouldHighlightTargets() {

protected void setStackInSlot(T screen, int slot, ItemStack itemStack) {
ContainerLogicProgrammerBase container = screen.getMenu();
Pair<Integer, Integer>[] 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));
Expand Down

0 comments on commit b2fc48c

Please sign in to comment.