fix: Fixed the index lookups for non-zero chunk locations

This commit is contained in:
Nicholas Novak 2023-11-28 21:17:55 -08:00
parent 9aa5e65c6c
commit cd06c19473

View File

@ -20,9 +20,9 @@ func (cd *ChunkData) IndexToBlockPos(index int) BlockPos {
posZ := ((index - posX) % 256) / 16 posZ := ((index - posX) % 256) / 16
posY := ((index - posZ) % 4096) / 256 posY := ((index - posZ) % 4096) / 256
return BlockPos{ return BlockPos{
X: posX + cd.Pos.X, X: posX + (cd.Pos.X * 16),
Y: uint(posY), Y: uint(posY),
Z: posZ + cd.Pos.Z, Z: posZ + (cd.Pos.Z * 16),
} }
} }