Fix contraption stopping action is not called in some cases (#526)

This commit is contained in:
Snownee 2020-12-09 07:47:40 +08:00
parent 3301f8ff01
commit 88ba7f2887
2 changed files with 9 additions and 1 deletions

View file

@ -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(); protected abstract StructureTransform makeStructureTransform();
@Override @Override

View file

@ -743,7 +743,6 @@ public abstract class Contraption {
} }
public void addBlocksToWorld(World world, StructureTransform transform) { public void addBlocksToWorld(World world, StructureTransform transform) {
stop(world);
for (boolean nonBrittles : Iterate.trueAndFalse) { for (boolean nonBrittles : Iterate.trueAndFalse) {
for (BlockInfo block : blocks.values()) { for (BlockInfo block : blocks.values()) {
if (nonBrittles == BlockMovementTraits.isBrittle(block.state)) if (nonBrittles == BlockMovementTraits.isBrittle(block.state))