Flywheel/src/main/java/com/jozufozu/flywheel/light/LightPacking.java

27 lines
520 B
Java
Raw Normal View History

2021-09-14 22:17:13 +02:00
package com.jozufozu.flywheel.light;
/**
* Utility class for bit-twiddling light.
*/
public class LightPacking {
public static int getBlock(short packed) {
return (packed >> 4) & 0xF;
}
public static int getSky(short packed) {
return (packed >> 12) & 0xF;
}
public static byte packLightNibbles(byte block, byte sky) {
return (byte) (block | (sky << 4));
}
public static int getBlock(byte packed) {
return packed & 0xF;
}
public static int getSky(byte packed) {
return (packed >> 4) & 0xF;
}
}