From 8cc65a405d6a64e71a303019baa5664d85f34c21 Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 18 Sep 2020 15:34:48 -0700 Subject: [PATCH] Fix off-by-one when cloning chunks --- bot/world/chunk.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bot/world/chunk.go b/bot/world/chunk.go index e01e3ce..8caafc3 100644 --- a/bot/world/chunk.go +++ b/bot/world/chunk.go @@ -3,6 +3,7 @@ package world import ( "bytes" "fmt" + "math" "github.com/Tnze/go-mc/data/block" pk "github.com/Tnze/go-mc/net/packet" @@ -137,7 +138,7 @@ func newSectionWithSize(bpb uint) *directSection { bitArray{ width: bpb, valsPerElement: valsPerElement, - data: make([]uint64, 16*16*16/valsPerElement), + data: make([]uint64, int(math.Ceil(16*16*16/float64(valsPerElement)))), }, } }