Fix belt funnel disappearing on contraption

This commit is contained in:
Snownee 2020-12-25 17:34:45 +08:00
parent e554c5a3ff
commit 6df81c8272
2 changed files with 8 additions and 9 deletions

View file

@ -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) {

View file

@ -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()) {