From 88ba7f2887fac3608516c36adac4c806b16c26ea Mon Sep 17 00:00:00 2001 From: Snownee Date: Wed, 9 Dec 2020 07:47:40 +0800 Subject: [PATCH] Fix contraption stopping action is not called in some cases (#526) --- .../structureMovement/AbstractContraptionEntity.java | 9 +++++++++ .../components/structureMovement/Contraption.java | 1 - 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java index c8bfc9585..91c8a10e4 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java @@ -435,6 +435,15 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit } } + @SuppressWarnings("deprecation") + @Override + public void remove(boolean keepData) { + if (!world.isRemote && !removed && contraption != null) { + contraption.stop(world); + } + super.remove(keepData); + } + protected abstract StructureTransform makeStructureTransform(); @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java index fd27685ce..c71acc94f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java @@ -743,7 +743,6 @@ public abstract class Contraption { } public void addBlocksToWorld(World world, StructureTransform transform) { - stop(world); for (boolean nonBrittles : Iterate.trueAndFalse) { for (BlockInfo block : blocks.values()) { if (nonBrittles == BlockMovementTraits.isBrittle(block.state))