Conversation
| } | ||
|
|
||
| // ring starts or refreshes the Bell ring state. | ||
| func (b Bell) ring(pos cube.Pos, tx *world.Tx, face cube.Face) bool { |
There was a problem hiding this comment.
Should this be exposed so bells can be triggered through code?
| // multipleSupportFaces returns the faces checked for a Bell attached between two side supports. | ||
| func (b Bell) multipleSupportFaces() (cube.Face, cube.Face) { | ||
| face := b.Facing.Face() | ||
| return face, face.Opposite() | ||
| } |
There was a problem hiding this comment.
Does this need to be a whole method if it's used just once?
| } | ||
|
|
||
| // bellFace returns a cube.Face from the given int32, or the fallback if the int32 is not a valid horizontal face. | ||
| func bellFace(v int32, fallback cube.Face) cube.Face { |
There was a problem hiding this comment.
Why does this take an int32 and cast to a cube.Face when all but one callers go from a cube.Face to an int?
| if c.ItemDropChance < 0 { | ||
| return | ||
| } | ||
| if c.ItemDropChance < 1 && c.ItemDropChance <= rand.Float64() { | ||
| return | ||
| } | ||
| for _, drop := range b.BreakInfo().Drops(item.ToolNone{}, nil) { | ||
| dropItem(tx, drop, pos.Vec3Centre()) | ||
| } |
There was a problem hiding this comment.
Should there be some sort of generic method on the explosion config if this logic has to be done for every block that handles explosion drops individually? Or is some of the logic here unique to bells
|
|
||
| // Explode ... | ||
| func (b Bell) Explode(_ mgl64.Vec3, pos cube.Pos, tx *world.Tx, c ExplosionConfig) { | ||
| b.ring(pos, tx, b.Facing.Face()) |
There was a problem hiding this comment.
This doesn't seem right, I cannot replicate this in vanilla
| if b.ringTicks < 50 { | ||
| tx.SetBlock(pos, b, &world.SetOpts{DisableBlockUpdates: true, DisableLiquidDisplacement: true}) | ||
| return | ||
| } | ||
| b.Toggle, b.ringTicks = false, 0 | ||
| tx.SetBlock(pos, b, &world.SetOpts{DisableBlockUpdates: true, DisableLiquidDisplacement: true}) |
There was a problem hiding this comment.
Can probably simplify this?
b.ringTicks++
if b.ringTicks >= 50 {
b.Toggle, b.ringTicks = false, 0
}
tx.SetBlock(pos, b, &world.SetOpts{DisableBlockUpdates: true, DisableLiquidDisplacement: true})
|
|
||
| // Activate ... | ||
| func (b Bell) Activate(pos cube.Pos, face cube.Face, tx *world.Tx, _ item.User, _ *item.UseContext) bool { | ||
| return b.ring(pos, tx, face) |
There was a problem hiding this comment.
It should only ring when interacting with the correct axis
| // ViewBlockUpdate views the updating of a block. It is called when a block is set at the position passed | ||
| // to the method. |
There was a problem hiding this comment.
Please document what nbtOnly is supposed to do
This PR adds initial Bell support
API Changes
world.Viewer{}.ViewBlockUpdatenow takes an additionalnbtOnly boolparameter:packet.UpdateBlockon every ring tick causes the ringing animation to look weird.