From 16b0d3e49332d45ef65f747c095ef54e15ff2979 Mon Sep 17 00:00:00 2001 From: DaPigGuy Date: Tue, 7 Jan 2025 02:40:24 -0800 Subject: [PATCH] block/tnt.go: Implement `ProjectileHitter` --- server/block/tnt.go | 7 +++++++ server/entity/projectile.go | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/server/block/tnt.go b/server/block/tnt.go index 5ed5c81f8..4606f4512 100644 --- a/server/block/tnt.go +++ b/server/block/tnt.go @@ -16,6 +16,13 @@ type TNT struct { solid } +// ProjectileHit ... +func (t TNT) ProjectileHit(pos cube.Pos, tx *world.Tx, e world.Entity, _ cube.Face) { + if f, ok := e.(flammableEntity); ok && f.OnFireDuration() > 0 { + t.Ignite(pos, tx, nil) + } +} + // Activate ... func (t TNT) Activate(pos cube.Pos, _ cube.Face, tx *world.Tx, u item.User, ctx *item.UseContext) bool { held, _ := u.HeldItems() diff --git a/server/entity/projectile.go b/server/entity/projectile.go index 079fa99ae..c2323d3b5 100644 --- a/server/entity/projectile.go +++ b/server/entity/projectile.go @@ -172,9 +172,6 @@ func (lt *ProjectileBehaviour) Tick(e *Ent, tx *world.Tx) *Movement { } case trace.BlockResult: bpos := r.BlockPosition() - if t, ok := tx.Block(bpos).(block.TNT); ok && e.OnFireDuration() > 0 { - t.Ignite(bpos, tx, nil) - } if h, ok := tx.Block(bpos).(block.ProjectileHitter); ok { h.ProjectileHit(bpos, tx, e, r.Face()) }