From 6df81c8272e4b533c75eaeeff4314c2d4db042b1 Mon Sep 17 00:00:00 2001 From: Snownee Date: Fri, 25 Dec 2020 17:34:45 +0800 Subject: [PATCH] Fix belt funnel disappearing on contraption --- .../components/structureMovement/Contraption.java | 14 +++++++------- .../structureMovement/TranslatingContraption.java | 3 +-- 2 files changed, 8 insertions(+), 9 deletions(-) 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 a38f76173..2f6c162b0 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 @@ -59,7 +59,6 @@ import net.minecraft.block.ChestBlock; import net.minecraft.block.DoorBlock; import net.minecraft.block.IWaterLoggable; import net.minecraft.block.PressurePlateBlock; -import net.minecraft.block.SlimeBlock; import net.minecraft.entity.Entity; import net.minecraft.fluid.Fluids; import net.minecraft.fluid.IFluidState; @@ -713,7 +712,7 @@ public abstract class Contraption { return nbt; } - public void removeBlocksFromWorld(IWorld world, BlockPos offset) { + public void removeBlocksFromWorld(World world, BlockPos offset) { storage.values() .forEach(MountedStorage::removeStorageFromWorld); fluidStorage.values() @@ -727,8 +726,7 @@ public abstract class Contraption { if (brittles != BlockMovementTraits.isBrittle(block.state)) continue; - BlockPos add = block.pos.add(anchor) - .add(offset); + BlockPos add = block.pos.add(anchor).add(offset); if (customBlockRemoval(world, add, block.state)) continue; BlockState oldState = world.getBlockState(add); @@ -737,9 +735,7 @@ public abstract class Contraption { iterator.remove(); world.getWorld() .removeTileEntity(add); - int flags = 67; - if (blockIn instanceof DoorBlock) - flags = flags | 32 | 16; + int flags = BlockFlags.IS_MOVING | BlockFlags.NO_NEIGHBOR_DROPS | BlockFlags.UPDATE_NEIGHBORS; if (blockIn instanceof IWaterLoggable && oldState.has(BlockStateProperties.WATERLOGGED) && oldState.get(BlockStateProperties.WATERLOGGED) .booleanValue()) { @@ -749,6 +745,10 @@ public abstract class Contraption { world.setBlockState(add, Blocks.AIR.getDefaultState(), flags); } } + for (BlockInfo block : blocks.values()) { + BlockPos add = block.pos.add(anchor).add(offset); + world.markAndNotifyBlock(add, null, block.state, Blocks.AIR.getDefaultState(), BlockFlags.IS_MOVING | BlockFlags.DEFAULT); + } } public void addBlocksToWorld(World world, StructureTransform transform) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/TranslatingContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/TranslatingContraption.java index 3f605dbb7..7e473df3b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/TranslatingContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/TranslatingContraption.java @@ -7,7 +7,6 @@ import java.util.Set; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IWorld; import net.minecraft.world.World; import net.minecraft.world.gen.feature.template.Template.BlockInfo; @@ -40,7 +39,7 @@ public abstract class TranslatingContraption extends Contraption { } @Override - public void removeBlocksFromWorld(IWorld world, BlockPos offset) { + public void removeBlocksFromWorld(World world, BlockPos offset) { int count = blocks.size(); super.removeBlocksFromWorld(world, offset); if (count != blocks.size()) {