diff --git a/Spigot-Server-Patches/0372-Anti-Xray.patch b/Spigot-Server-Patches/0372-Anti-Xray.patch index 57a2ee2216..0e6bb715a4 100644 --- a/Spigot-Server-Patches/0372-Anti-Xray.patch +++ b/Spigot-Server-Patches/0372-Anti-Xray.patch @@ -847,10 +847,10 @@ index 0000000000000000000000000000000000000000..e61421d87a19bf2f6ce8836b48c445ff +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java b/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java new file mode 100644 -index 0000000000000000000000000000000000000000..8b8c2a0156fd936ea422b64ca6372fa6bd31be32 +index 0000000000000000000000000000000000000000..298ea423084dbcc1b61f991bcd82b8ae51bf0977 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java -@@ -0,0 +1,52 @@ +@@ -0,0 +1,51 @@ +package com.destroystokyo.paper.antixray; + +public final class DataBitsReader { @@ -891,21 +891,20 @@ index 0000000000000000000000000000000000000000..8b8c2a0156fd936ea422b64ca6372fa6 + } + + public int read() { -+ int value = (int) (current >>> bitInLongIndex) & mask; -+ bitInLongIndex += bitsPerObject; -+ -+ if (bitInLongIndex > 63) { ++ if (bitInLongIndex + bitsPerObject > 64) { + bitInLongIndex = 0; + longInDataBitsIndex += 8; + init(); + } + ++ int value = (int) (current >>> bitInLongIndex) & mask; ++ bitInLongIndex += bitsPerObject; + return value; + } +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java b/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java new file mode 100644 -index 0000000000000000000000000000000000000000..5260882a319d5f897dd20e149d17077cb3f843ea +index 0000000000000000000000000000000000000000..333763936897befda5bb6c077944d2667f922799 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java @@ -0,0 +1,79 @@ @@ -965,24 +964,24 @@ index 0000000000000000000000000000000000000000..5260882a319d5f897dd20e149d17077c + } + + public void write(int value) { -+ current = current & ~(mask << bitInLongIndex) | (value & mask) << bitInLongIndex; -+ dirty = true; -+ bitInLongIndex += bitsPerObject; -+ -+ if (bitInLongIndex > 63) { ++ if (bitInLongIndex + bitsPerObject > 64) { + finish(); + bitInLongIndex = 0; + longInDataBitsIndex += 8; + init(); + } ++ ++ current = current & ~(mask << bitInLongIndex) | (value & mask) << bitInLongIndex; ++ dirty = true; ++ bitInLongIndex += bitsPerObject; + } + + public void skip() { + bitInLongIndex += bitsPerObject; + -+ if (bitInLongIndex > 63) { ++ if (bitInLongIndex > 64) { + finish(); -+ bitInLongIndex = 0; ++ bitInLongIndex = bitsPerObject; + longInDataBitsIndex += 8; + init(); + }