mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-30 20:29:10 +00:00
Updated Upstream (Purpur)
Upstream has released updates that appear to apply and compile correctly Purpur Changes: PurpurMC/Purpur@617240e Updated Upstream (Paper)
This commit is contained in:
@@ -23,22 +23,22 @@ index 512afaa97e89e3beb92cf2ebc46248eddd22cf5c..50878e4948df45bc2928edbe373be639
|
||||
}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
index 1f4b64a5f812376c499c98cb4be62469bd0b7dbe..2b1ae08ec33daedd0148f6731145a1d10a89277c 100644
|
||||
index 622421275a9408908be537f2263a4aa6233d4f88..ef6df345edc72e087cb8e4971d0648d110b58612 100644
|
||||
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
@@ -84,6 +84,8 @@ import org.joml.Vector3f;
|
||||
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit
|
||||
|
||||
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit
|
||||
|
||||
+import gq.bxteam.divinemc.configuration.DivineConfig; // DivineMC
|
||||
+
|
||||
public class FriendlyByteBuf extends ByteBuf {
|
||||
|
||||
private static final int MAX_VARINT_SIZE = 5;
|
||||
public class FriendlyByteBuf extends ByteBuf {
|
||||
|
||||
private static final int MAX_VARINT_SIZE = 5;
|
||||
@@ -104,7 +106,22 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
this.source = parent;
|
||||
}
|
||||
|
||||
this.source = parent;
|
||||
}
|
||||
|
||||
+ // DivineMC start - Optimize varints
|
||||
+ private static final int[] VARINT_EXACT_BYTE_LENGTHS = new int[33];
|
||||
+ static {
|
||||
@@ -49,19 +49,19 @@ index 1f4b64a5f812376c499c98cb4be62469bd0b7dbe..2b1ae08ec33daedd0148f6731145a1d1
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
+
|
||||
public static int getVarIntSize(int value) {
|
||||
public static int getVarIntSize(int value) {
|
||||
+ // DivineMC start - Optimize varints
|
||||
+ if (DivineConfig.doOptimizeVarints) {
|
||||
+ return VARINT_EXACT_BYTE_LENGTHS[Integer.numberOfLeadingZeros(value)];
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
for (int j = 1; j < 5; ++j) {
|
||||
if ((value & -1 << j * 7) == 0) {
|
||||
return j;
|
||||
for (int j = 1; j < 5; ++j) {
|
||||
if ((value & -1 << j * 7) == 0) {
|
||||
return j;
|
||||
@@ -615,6 +632,23 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
}
|
||||
|
||||
public FriendlyByteBuf writeVarInt(int value) {
|
||||
}
|
||||
|
||||
public FriendlyByteBuf writeVarInt(int value) {
|
||||
+ // DivineMC start - Optimize varints
|
||||
+ if (DivineConfig.doOptimizeVarints) {
|
||||
+ if ((value & (0xFFFFFFFF << 7)) == 0) {
|
||||
@@ -79,6 +79,6 @@ index 1f4b64a5f812376c499c98cb4be62469bd0b7dbe..2b1ae08ec33daedd0148f6731145a1d1
|
||||
+ return this;
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
while ((value & -128) != 0) {
|
||||
this.writeByte(value & 127 | 128);
|
||||
value >>>= 7;
|
||||
while ((value & -128) != 0) {
|
||||
this.writeByte(value & 127 | 128);
|
||||
value >>>= 7;
|
||||
|
||||
Reference in New Issue
Block a user