Skip to content

Commit fa6b195

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

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222

2323
import javax.annotation.Nullable;
2424

25+
import net.minecraft.world.Container;
26+
import net.minecraft.world.Containers;
27+
2528
import org.apache.commons.lang3.tuple.MutablePair;
2629
import org.apache.commons.lang3.tuple.Pair;
2730

@@ -1167,6 +1170,14 @@ public void addBlocksToWorld(Level world, StructureTransform transform) {
11671170
.isEmpty())) {
11681171
if (targetPos.getY() == world.getMinBuildHeight())
11691172
targetPos = targetPos.above();
1173+
if(state.hasBlockEntity()){
1174+
CompoundTag tag = block.nbt();
1175+
if(tag != null){
1176+
BlockEntity blockEntity = BlockEntity.loadStatic(targetPos, state, tag);
1177+
if (blockEntity instanceof Container container)
1178+
Containers.dropContents(world, targetPos, container);
1179+
}
1180+
}
11701181
world.levelEvent(2001, targetPos, Block.getId(state));
11711182
Block.dropResources(state, world, targetPos, null);
11721183
continue;

0 commit comments

Comments
 (0)