Skip to content

Commit 1ae64ca

Browse files
committed
use new ProjectileHit interface
1 parent f8b2109 commit 1ae64ca

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

server/block/button.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ func (b Button) Activate(pos cube.Pos, _ cube.Face, tx *world.Tx, _ item.User, _
7878
return b.Click(pos, tx)
7979
}
8080

81+
// ProjectileHit ...
82+
func (b Button) ProjectileHit(pos cube.Pos, tx *world.Tx, e world.Entity, face cube.Face) {
83+
if b.Type == StoneButton() || b.Type == PolishedBlackstoneButton() {
84+
return
85+
}
86+
87+
b.Click(pos, tx)
88+
}
89+
8190
// Click ...
8291
func (b Button) Click(pos cube.Pos, tx *world.Tx) bool {
8392
if b.Pressed {

server/entity/projectile.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,6 @@ func (lt *ProjectileBehaviour) Tick(e *Ent, tx *world.Tx) *Movement {
175175
if h, ok := tx.Block(bpos).(block.ProjectileHitter); ok {
176176
h.ProjectileHit(bpos, tx, e, r.Face())
177177
}
178-
if b, ok := tx.Block(bpos).(block.Button); ok {
179-
if b.Type != block.StoneButton() || b.Type != block.PolishedBlackstoneButton() {
180-
b.Click(bpos, tx)
181-
}
182-
}
183178
if t, ok := tx.Block(bpos).(block.Target); ok {
184179
if _, ok := e.H().Type().(enderPearlType); !ok {
185180
delay := time.Millisecond * 400

0 commit comments

Comments
 (0)