From 5532f493bf8e36e17d141c5d2e1be50e5dad8813 Mon Sep 17 00:00:00 2001 From: DaPigGuy Date: Tue, 7 Jan 2025 02:09:18 -0800 Subject: [PATCH] block/decorated_pot.go: Shatter on projectile hit --- server/block/decorated_pot.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/server/block/decorated_pot.go b/server/block/decorated_pot.go index 607c197dd..958249510 100644 --- a/server/block/decorated_pot.go +++ b/server/block/decorated_pot.go @@ -33,6 +33,18 @@ type DecoratedPot struct { Decorations [4]PotDecoration } +// ProjectileHit ... +func (p DecoratedPot) ProjectileHit(pos cube.Pos, tx *world.Tx, _ world.Entity, _ cube.Face) { + for _, d := range p.Decorations { + if d == nil { + dropItem(tx, item.NewStack(item.Brick{}, 1), pos.Vec3Centre()) + continue + } + dropItem(tx, item.NewStack(d, 1), pos.Vec3Centre()) + } + breakBlockNoDrops(p, pos, tx) +} + // Pick ... func (p DecoratedPot) Pick() item.Stack { return item.NewStack(DecoratedPot{Decorations: p.Decorations}, 1)