Class BlockKey
java.lang.Object
de.eldoria.schematicbrush.rendering.BlockKey
Packs block and section coordinates into a single
long.
x and z use 26 bits each, y uses 12 bits, which covers the world border and every supported build height. The same
layout is used for section keys, which hold the section coordinates (coordinate >> 4).
-
Method Summary
Modifier and TypeMethodDescriptionstatic longof(int x, int y, int z) Packs coordinates into a key.static longsection(int x, int y, int z) Returns the key of the section that contains a block.static longsection(long blockKey) Returns the key of the section that contains a block.static intx(long key) Unpacks the x coordinate.static inty(long key) Unpacks the y coordinate.static intz(long key) Unpacks the z coordinate.
-
Method Details
-
of
public static long of(int x, int y, int z) Packs coordinates into a key.- Parameters:
x- x coordinatey- y coordinatez- z coordinate- Returns:
- packed key
-
section
public static long section(long blockKey) Returns the key of the section that contains a block.- Parameters:
blockKey- packed block key- Returns:
- packed section key
-
section
public static long section(int x, int y, int z) Returns the key of the section that contains a block.- Parameters:
x- block x coordinatey- block y coordinatez- block z coordinate- Returns:
- packed section key
-
x
public static int x(long key) Unpacks the x coordinate.- Parameters:
key- packed key- Returns:
- x coordinate
-
y
public static int y(long key) Unpacks the y coordinate.- Parameters:
key- packed key- Returns:
- y coordinate
-
z
public static int z(long key) Unpacks the z coordinate.- Parameters:
key- packed key- Returns:
- z coordinate
-