Skip to content

Commit

Permalink
add jukebox logic
Browse files Browse the repository at this point in the history
  • Loading branch information
xNatsuri committed Jan 7, 2025
1 parent 65efd3a commit 71c7f66
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions server/block/jukebox.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ func (j Jukebox) Activate(pos cube.Pos, _ cube.Face, tx *world.Tx, u item.User,
}
}
}
updateAroundRedstone(pos, tx)
return true
}

Expand All @@ -105,6 +106,24 @@ func (j Jukebox) Disc() (sound.DiscType, bool) {
return sound.DiscType{}, false
}

// WeakPower ...
func (j Jukebox) WeakPower(pos cube.Pos, face cube.Face, tx *world.Tx, accountForDust bool) int {
if !j.Item.Empty() {
return 15
}
return 0
}

// StrongPower ...
func (j Jukebox) StrongPower(pos cube.Pos, face cube.Face, tx *world.Tx, accountForDust bool) int {
return j.WeakPower(pos, face, tx, accountForDust)
}

// RedstoneSource ...
func (j Jukebox) RedstoneSource() bool {
return !j.Item.Empty()
}

// EncodeNBT ...
func (j Jukebox) EncodeNBT() map[string]any {
m := map[string]any{"id": "Jukebox"}
Expand Down

0 comments on commit 71c7f66

Please sign in to comment.