Skip to content

Commit

Permalink
fix container drops with explosions
Browse files Browse the repository at this point in the history
  • Loading branch information
xNatsuri committed Aug 15, 2024
1 parent deb6d9c commit 3e5d290
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions server/block/explosion.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,26 @@ func (c ExplosionConfig) Explode(w *world.World, explosionPos mgl64.Vec3) {
dropItem(w, drop, pos.Vec3Centre())
}
}

if container, ok := bl.(Container); ok {
if cb, ok := bl.(Chest); ok {
if cb.Paired() {
pairPos := cb.pairPos(pos)
if _, pair, ok := cb.unpair(w, pos); ok {
cb.paired = false
w.SetBlock(pairPos, pair, nil)
}
}

for _, i := range cb.Inventory(w, pos).Clear() {
dropItem(w, i, pos.Vec3())
}
} else {
for _, i := range container.Inventory(w, pos).Clear() {
dropItem(w, i, pos.Vec3())
}
}
}
}
}
if c.SpawnFire {
Expand Down

0 comments on commit 3e5d290

Please sign in to comment.