From 7d372af51e674ae04213dae55497e1c6e1a3849e Mon Sep 17 00:00:00 2001 From: NuclearW Date: Fri, 6 Jul 2012 17:41:00 -0400 Subject: [PATCH] Some address byte comments --- .../blockmeta/PrimitiveChunkletStore.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/PrimitiveChunkletStore.java b/src/main/java/com/gmail/nossr50/util/blockmeta/PrimitiveChunkletStore.java index e6b022725..8f6b1cf1a 100644 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/PrimitiveChunkletStore.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/PrimitiveChunkletStore.java @@ -108,6 +108,25 @@ public class PrimitiveChunkletStore implements ChunkletStore { return column; } + /* + * The address byte: A single byte which contains x and z values which correspond to the x and z Chunklet-coordinates + * + * In Chunklet-coordinates, the only valid values are 0-15, so we can fit both into a single byte. + * + * The top 4 bits of the address byte are for the x value + * The bottom 4 bits of the address byte are for the z value + * + * Examples: + * An address byte with a value 00000001 would be split like so: + * - x = 0000 = 0 + * - z = 0001 = 1 + * => Chunklet coordinates (0, 1) + * + * 01011111 + * - x = 0101 = 5 + * - z = 1111 = 15 + * => Chunklet coordinates (5, 15) + */ private static byte makeAddressByte(int x, int z) { return (byte) ((x << 4) + z); }