mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-24 21:04:27 +00:00
All 10MB of NBT Size to function
This commit is contained in:
1 parent
de56032118
commit
06275fffa6
4 files changed
+42
-20
No files matched your search
@@ -9,6 +9,8 @@ import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.village.MerchantRecipeList;
|
||||
import noppes.npcs.LogWriter;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -100,6 +102,19 @@ public class ByteBufUtils extends cpw.mods.fml.common.network.ByteBufUtils {
|
||||
return CompressedStreamTools.func_152457_a(bytes, new NBTSizeTracker(2097152L));
|
||||
}
|
||||
|
||||
public static void writeBigNBT(ByteBuf buffer, NBTTagCompound compound) throws IOException {
|
||||
byte[] bytes = CompressedStreamTools.compress(compound);
|
||||
buffer.writeInt(bytes.length);
|
||||
buffer.writeBytes(bytes);
|
||||
}
|
||||
|
||||
public static NBTTagCompound readBigNBT(ByteBuf buffer) throws IOException {
|
||||
int length = buffer.readInt();
|
||||
byte[] bytes = new byte[length];
|
||||
buffer.readBytes(bytes);
|
||||
return CompressedStreamTools.func_152457_a(bytes, new NBTSizeTracker(10485760L));
|
||||
}
|
||||
|
||||
public static void writeString(ByteBuf buffer, String s){
|
||||
byte[] bytes = s.getBytes(Charsets.UTF_8);
|
||||
buffer.writeShort((short)bytes.length);
|
||||
|
||||
Reference in new issue
Block a user