From 571b73c0518de73e2c07c1d6e82210119ee07224 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 4 Dec 2024 22:25:22 +0100 Subject: [PATCH] don't allow items to be inserted into a terminal's return slots --- .../prettypipes/terminal/CraftingTerminalBlockEntity.java | 2 +- .../ellpeck/prettypipes/terminal/ItemTerminalBlockEntity.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/ellpeck/prettypipes/terminal/CraftingTerminalBlockEntity.java b/src/main/java/de/ellpeck/prettypipes/terminal/CraftingTerminalBlockEntity.java index 328bbbe..b41926f 100644 --- a/src/main/java/de/ellpeck/prettypipes/terminal/CraftingTerminalBlockEntity.java +++ b/src/main/java/de/ellpeck/prettypipes/terminal/CraftingTerminalBlockEntity.java @@ -205,7 +205,7 @@ public class CraftingTerminalBlockEntity extends ItemTerminalBlockEntity { } } while (lowestSlot >= 0); - return ItemHandlerHelper.insertItemStacked(tile.items, remain, simulate); + return ItemHandlerHelper.insertItemStacked(new RangedWrapper(tile.items, 0, 6), remain, simulate); } return remain; } diff --git a/src/main/java/de/ellpeck/prettypipes/terminal/ItemTerminalBlockEntity.java b/src/main/java/de/ellpeck/prettypipes/terminal/ItemTerminalBlockEntity.java index fe8c096..c8ee607 100644 --- a/src/main/java/de/ellpeck/prettypipes/terminal/ItemTerminalBlockEntity.java +++ b/src/main/java/de/ellpeck/prettypipes/terminal/ItemTerminalBlockEntity.java @@ -31,6 +31,7 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.neoforged.neoforge.items.ItemHandlerHelper; import net.neoforged.neoforge.items.ItemStackHandler; +import net.neoforged.neoforge.items.wrapper.RangedWrapper; import org.apache.commons.lang3.tuple.Pair; import javax.annotation.Nonnull; @@ -258,7 +259,7 @@ public class ItemTerminalBlockEntity extends BlockEntity implements IPipeConnect var pos = pipePos.relative(direction); var tile = Utility.getBlockEntity(ItemTerminalBlockEntity.class, this.level, pos); if (tile != null) - return ItemHandlerHelper.insertItemStacked(tile.items, stack, simulate); + return ItemHandlerHelper.insertItemStacked(new RangedWrapper(tile.items, 0, 6), stack, simulate); return stack; }