(x, y, z int, level byte)
| 161 | } |
| 162 | |
| 163 | func (s *Section) SetSkylightLevel(x, y, z int, level byte) error { |
| 164 | if level > 0x0F { |
| 165 | return fmt.Errorf("light level must not exceed 4 bits (15)") |
| 166 | } |
| 167 | index := (y << 8) | (z << 4) | x |
| 168 | if index < 0 || int(index) > len(s.SkyLight) { |
| 169 | return fmt.Errorf("light index exceeds light length") |
| 170 | } |
| 171 | |
| 172 | var mask uint8 = 0x0f |
| 173 | if math.Remainder(float64(index), 2) != 0 { |
| 174 | mask = 0xf0 |
| 175 | level <<= 4 |
| 176 | } |
| 177 | |
| 178 | index /= 2 |
| 179 | |
| 180 | s.SkyLight[index] = s.SkyLight[index] & ^int8(mask) |
| 181 | s.SkyLight[index] |= int8(level) |
| 182 | |
| 183 | return nil |
| 184 | } |
| 185 | |
| 186 | func blockBitsPerEntry(paletteSize int) int { |
| 187 | ln := bits.Len32(uint32(paletteSize) - 1) |
nothing calls this directly
no outgoing calls
no test coverage detected