diff --git a/bot/world/chunk.go b/bot/world/chunk.go index 8fd6b90..5d339df 100644 --- a/bot/world/chunk.go +++ b/bot/world/chunk.go @@ -3,9 +3,9 @@ package world import ( "bytes" "fmt" - // "io" "github.com/Tnze/go-mc/data" pk "github.com/Tnze/go-mc/net/packet" + "math" ) // DecodeChunkColumn decode the chunk data structure. @@ -120,15 +120,18 @@ func (d *directSection) GetBlock(x, y, z int) BlockStatus { func (d *directSection) SetBlock(x, y, z int, s BlockStatus) { offset := (x + z*16 + y*16*16) * d.bpb padding := offset % 64 - const maxUint64 = 1<<64 - 1 - mask := uint64(maxUint64<<(padding+d.bpb) | (1< 64-d.bpb { l := padding - (64 - d.bpb) - d.data[offset/64+1] = d.data[offset/64+1]&(maxUint64<>(64-padding) + d.data[offset/64+1] = d.data[offset/64+1]&(math.MaxUint64<>(64-padding) } } +func (d *directSection) CanContain(s BlockStatus) bool { + return s <= (1<