From 737578a90e471b581576dbdc3109ffbba5cf6ccf Mon Sep 17 00:00:00 2001 From: Xavier Stouder Date: Tue, 13 Sep 2022 23:33:32 +0200 Subject: [PATCH 1/2] fix: item duplication bug Avoid ejecting the grid if mechanical crafter is moving. Should fix #3741 --- .../components/crafter/MechanicalCrafterBlock.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterBlock.java index 47062a61b..c2bea46c5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterBlock.java @@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.components.crafter; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; import com.simibubi.create.AllTileEntities; +import com.simibubi.create.Create; import com.simibubi.create.content.contraptions.base.HorizontalKineticBlock; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.components.crafter.ConnectedInputHandler.ConnectedInput; @@ -95,12 +96,15 @@ public class MechanicalCrafterBlock extends HorizontalKineticBlock } } + Create.LOGGER.info("onRemove:" + (isMoving ? "moving" : "not moving")); + if (state.hasBlockEntity() && state.getBlock() != newState.getBlock()) { MechanicalCrafterTileEntity crafter = CrafterHelper.getCrafter(worldIn, pos); if (crafter != null) { if (crafter.covered) Block.popResource(worldIn, pos, AllItems.CRAFTER_SLOT_COVER.asStack()); - crafter.ejectWholeGrid(); + if (!isMoving) + crafter.ejectWholeGrid(); } for (Direction direction : Iterate.directions) { From 5ae74c6810fe2bec9af52f3522e1b76913773490 Mon Sep 17 00:00:00 2001 From: Xavier Stouder Date: Tue, 13 Sep 2022 23:40:22 +0200 Subject: [PATCH 2/2] chore: remove debug logs --- .../components/crafter/MechanicalCrafterBlock.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterBlock.java index c2bea46c5..8668795c7 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterBlock.java @@ -3,7 +3,6 @@ package com.simibubi.create.content.contraptions.components.crafter; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; import com.simibubi.create.AllTileEntities; -import com.simibubi.create.Create; import com.simibubi.create.content.contraptions.base.HorizontalKineticBlock; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.components.crafter.ConnectedInputHandler.ConnectedInput; @@ -96,8 +95,6 @@ public class MechanicalCrafterBlock extends HorizontalKineticBlock } } - Create.LOGGER.info("onRemove:" + (isMoving ? "moving" : "not moving")); - if (state.hasBlockEntity() && state.getBlock() != newState.getBlock()) { MechanicalCrafterTileEntity crafter = CrafterHelper.getCrafter(worldIn, pos); if (crafter != null) {