MCPcopy Create free account
hub / github.com/ZeppelinMC/Zeppelin / blockState

Method blockState

server/world/chunk/section/section.go:69–79  ·  view source on GitHub ↗
(x, y, z byte)

Source from the content-addressed store, hash-verified

67}
68
69func (s *Section) blockState(x, y, z byte) int64 {
70 if len(s.BlockStates.Data) == 0 {
71 return 0
72 }
73
74 long, off := s.offset(int(x), int(y), int(z))
75 l := s.BlockStates.Data[long]
76 index := (l >> off) & (1<<s.blockBitsPerEntry - 1)
77
78 return index
79}
80
81// Sets the block at the position to the index in the palette. Errors if the state is bigger than the length of the palette or negative
82// X, Y, Z should be relative to the chunk section (AKA x&0x0f, y&0x0f, z&0x0f)

Callers 1

SetBlockMethod · 0.95

Calls 1

offsetMethod · 0.95

Tested by

no test coverage detected