Skip to content

Commit 73635d2

Browse files
committed
you should drop your stuff before poping!
1 parent 1c4ad64 commit 73635d2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/main/java/com/simibubi/create/content/contraptions/Contraption.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@
9494
import net.minecraft.network.protocol.game.DebugPackets;
9595
import net.minecraft.resources.ResourceLocation;
9696
import net.minecraft.server.level.ServerLevel;
97+
import net.minecraft.world.Container;
98+
import net.minecraft.world.Containers;
9799
import net.minecraft.world.entity.Entity;
98100
import net.minecraft.world.entity.ai.village.poi.PoiTypes;
99101
import net.minecraft.world.item.ItemStack;
@@ -1167,6 +1169,14 @@ public void addBlocksToWorld(Level world, StructureTransform transform) {
11671169
.isEmpty())) {
11681170
if (targetPos.getY() == world.getMinBuildHeight())
11691171
targetPos = targetPos.above();
1172+
if(state.hasBlockEntity()){
1173+
CompoundTag tag = block.nbt();
1174+
if(tag != null){
1175+
BlockEntity blockEntity = BlockEntity.loadStatic(targetPos, state, tag);
1176+
if (blockEntity instanceof Container container)
1177+
Containers.dropContents(world, targetPos, container);
1178+
}
1179+
}
11701180
world.levelEvent(2001, targetPos, Block.getId(state));
11711181
Block.dropResources(state, world, targetPos, null);
11721182
continue;

0 commit comments

Comments
 (0)