From b3de4de0cd95e8d22244d2791ef7c726448830b5 Mon Sep 17 00:00:00 2001 From: Myles Date: Mon, 7 Mar 2016 16:34:22 +0000 Subject: [PATCH] Remove us.myles.ViaVersion.chunks, I must have looked past this but it's not used. --- .../myles/ViaVersion/chunks/ByteWriter.java | 51 ------------------- .../myles/ViaVersion/chunks/MagicBitSet.java | 14 ----- .../myles/ViaVersion/chunks/PacketChunk.java | 14 ----- .../ViaVersion/chunks/PacketChunkData.java | 25 --------- 4 files changed, 104 deletions(-) delete mode 100644 src/main/java/us/myles/ViaVersion/chunks/ByteWriter.java delete mode 100644 src/main/java/us/myles/ViaVersion/chunks/MagicBitSet.java delete mode 100644 src/main/java/us/myles/ViaVersion/chunks/PacketChunk.java delete mode 100644 src/main/java/us/myles/ViaVersion/chunks/PacketChunkData.java diff --git a/src/main/java/us/myles/ViaVersion/chunks/ByteWriter.java b/src/main/java/us/myles/ViaVersion/chunks/ByteWriter.java deleted file mode 100644 index eca189d66..000000000 --- a/src/main/java/us/myles/ViaVersion/chunks/ByteWriter.java +++ /dev/null @@ -1,51 +0,0 @@ -package us.myles.ViaVersion.chunks; - -import lombok.Getter; - -@Getter -public class ByteWriter { - - private final byte[] output; - private int byteIndex; - private int bitIndex; - - public ByteWriter(int size) { - this.output = new byte[size]; - this.byteIndex = 0; - this.bitIndex = 0; - } - public void writeFullByte(int b){ - writeByte(b, 8); - } - - public void writeByte(int b, int length) { - byte current = getCurrentByte(); - byte byteB = (byte)(int)((b) & 0xff); - System.out.println("Input: " + byteB); - System.out.println(Integer.toBinaryString(byteB)); - - int space = (8 - bitIndex); - int written = space > length ? length : space; - System.out.println("Written is " + written); - output[byteIndex] = (byte) (current | (extractRange(byteB, 0, written) >> (bitIndex - 1))); - System.out.println("output value: " + output[byteIndex]); - this.bitIndex += length; - if(this.bitIndex >= 8) { - this.byteIndex += 1; - this.bitIndex = bitIndex - 8; - // write remaining into this - System.out.println("Writing from " + written + " to " + (written + bitIndex)); - System.out.println("Value: " + extractRange(byteB, written, written + bitIndex)); - output[byteIndex] = (byte) (extractRange(byteB, written, written + bitIndex) << written); - } - } - - private byte extractRange(int in, int begin, int end){ - return (byte) ((in >> begin) & ((1 << (end - begin)) - 1)); - } - public byte getCurrentByte() { - if (byteIndex == output.length) throw new RuntimeException("ByteWriter overflow!"); - - return output[byteIndex]; - } -} diff --git a/src/main/java/us/myles/ViaVersion/chunks/MagicBitSet.java b/src/main/java/us/myles/ViaVersion/chunks/MagicBitSet.java deleted file mode 100644 index 64b454086..000000000 --- a/src/main/java/us/myles/ViaVersion/chunks/MagicBitSet.java +++ /dev/null @@ -1,14 +0,0 @@ -package us.myles.ViaVersion.chunks; - -import lombok.RequiredArgsConstructor; - -import java.util.BitSet; - -@RequiredArgsConstructor -public class MagicBitSet extends BitSet { - private final int initLength; - - public int getTrueLength() { - return length() == 0 ? initLength : length(); - } -} diff --git a/src/main/java/us/myles/ViaVersion/chunks/PacketChunk.java b/src/main/java/us/myles/ViaVersion/chunks/PacketChunk.java deleted file mode 100644 index f0c235615..000000000 --- a/src/main/java/us/myles/ViaVersion/chunks/PacketChunk.java +++ /dev/null @@ -1,14 +0,0 @@ -package us.myles.ViaVersion.chunks; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -public class PacketChunk { - - private PacketChunkData[] chunkData; - private byte[] biomeData; -} diff --git a/src/main/java/us/myles/ViaVersion/chunks/PacketChunkData.java b/src/main/java/us/myles/ViaVersion/chunks/PacketChunkData.java deleted file mode 100644 index 69bef5dae..000000000 --- a/src/main/java/us/myles/ViaVersion/chunks/PacketChunkData.java +++ /dev/null @@ -1,25 +0,0 @@ -package us.myles.ViaVersion.chunks; - -public class PacketChunkData { - private short[] blocks = new short[4096]; - private byte[] blockLight = new byte[2048]; - private byte[] skyLight; - - public PacketChunkData(boolean isSkyLightData) { - if(isSkyLightData){ - skyLight = new byte[2048]; - } - } - - public short[] getBlocks() { - return this.blocks; - } - - public byte[] getBlockLight() { - return this.blockLight; - } - - public byte[] getSkyLight() { - return this.skyLight; - } -}