From 7bd602a33f838bd8904c4ac8edf9cc21220862e4 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Mon, 15 Jul 2024 11:44:30 +0200 Subject: [PATCH] The Dupe Chute - Fixed a duplication bug involving belts and chutes #6210 #5781 #6686 --- .../content/kinetics/belt/transport/BeltInventory.java | 2 ++ .../belt/transport/ItemHandlerBeltSegment.java | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/kinetics/belt/transport/BeltInventory.java b/src/main/java/com/simibubi/create/content/kinetics/belt/transport/BeltInventory.java index 42b0939f6..1d1b80b05 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/belt/transport/BeltInventory.java +++ b/src/main/java/com/simibubi/create/content/kinetics/belt/transport/BeltInventory.java @@ -378,6 +378,8 @@ public class BeltInventory { float min = offset; float max = offset + 1; for (TransportedItemStack stack : items) { + if (toRemove.contains(stack)) + continue; if (stack.beltPosition > max) continue; if (stack.beltPosition > min) diff --git a/src/main/java/com/simibubi/create/content/kinetics/belt/transport/ItemHandlerBeltSegment.java b/src/main/java/com/simibubi/create/content/kinetics/belt/transport/ItemHandlerBeltSegment.java index 3395f9393..0a5248c5f 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/belt/transport/ItemHandlerBeltSegment.java +++ b/src/main/java/com/simibubi/create/content/kinetics/belt/transport/ItemHandlerBeltSegment.java @@ -50,13 +50,15 @@ public class ItemHandlerBeltSegment implements IItemHandler { return ItemStack.EMPTY; amount = Math.min(amount, transported.stack.getCount()); - ItemStack extracted = simulate ? transported.stack.copy().split(amount) : transported.stack.split(amount); + ItemStack extracted = simulate ? transported.stack.copy() + .split(amount) : transported.stack.split(amount); if (!simulate) { if (transported.stack.isEmpty()) - this.beltInventory.toRemove.add(transported); - this.beltInventory.belt.setChanged(); - this.beltInventory.belt.sendData(); + beltInventory.toRemove.add(transported); + else + beltInventory.belt.notifyUpdate(); } + return extracted; }