DBC FORM SYNC

This commit is contained in:
Kam committed 2024-04-15 19:20:24 -04:00
1 parent bb0d90f754
commit 4590275695
5 files changed
+46 -2

No files matched your search

@@ -866,6 +866,27 @@ public class NoppesUtilServer {
}
}
public static void sendDBCCompound(EntityPlayerMP player, NBTTagCompound compound) {
try {
byte[] bytes = CompressedStreamTools.compress(compound);
// Split byte array into chunks and send each chunk
int chunkSize = 16000;
int totalChunks = (int) Math.ceil((double) bytes.length / chunkSize);
for (int i = 0; i < totalChunks; i++) {
int start = i * chunkSize;
int length = Math.min(bytes.length - start, chunkSize);
byte[] chunk = new byte[length];
System.arraycopy(bytes, start, chunk, 0, length);
Server.sendData(player, EnumPacketClient.LARGE_NBT_PART, (Object) chunk);
}
// Send end packet
Server.sendData(player, EnumPacketClient.DBC_FORM);
} catch (IOException e) {
e.printStackTrace();
}
}
public static boolean isOp(EntityPlayer player) {
return MinecraftServer.getServer().getConfigurationManager().func_152596_g(player.getGameProfile());