(x, y, z int)
| 143 | } |
| 144 | |
| 145 | func (s *Section) SkyLightLevel(x, y, z int) (byte, error) { |
| 146 | index := (y << 8) | (z << 4) | x |
| 147 | if index < 0 || int(index) > len(s.SkyLight) { |
| 148 | return 0, fmt.Errorf("light index exceeds light length") |
| 149 | } |
| 150 | |
| 151 | var mask uint8 = 0x0f |
| 152 | var shift uint8 = 0 |
| 153 | if math.Remainder(float64(index), 2) != 0 { |
| 154 | mask = 0xf0 |
| 155 | shift = 4 |
| 156 | } |
| 157 | |
| 158 | index /= 2 |
| 159 | |
| 160 | return (uint8(s.SkyLight[index]) & mask) >> shift, nil |
| 161 | } |
| 162 | |
| 163 | func (s *Section) SetSkylightLevel(x, y, z int, level byte) error { |
| 164 | if level > 0x0F { |
nothing calls this directly
no outgoing calls
no test coverage detected