ForgePatch/patches/minecraft/net/minecraft/nbt/CompoundNBT.java.patch

33 lines
1.5 KiB
Diff

--- a/net/minecraft/nbt/CompoundNBT.java
+++ b/net/minecraft/nbt/CompoundNBT.java
@@ -49,6 +49,7 @@
while((b0 = CompoundNBT.func_152447_a(p_225649_1_, p_225649_3_)) != 0) {
String s = CompoundNBT.func_152448_b(p_225649_1_, p_225649_3_);
p_225649_3_.func_152450_a((long)(224 + 16 * s.length()));
+ p_225649_3_.func_152450_a(32); //Forge: 4 extra bytes for the object allocation.
INBT inbt = CompoundNBT.func_229680_b_(NBTTypes.func_229710_a_(b0), s, p_225649_1_, p_225649_2_ + 1, p_225649_3_);
if (map.put(s, inbt) != null) {
p_225649_3_.func_152450_a(288L);
@@ -104,6 +105,7 @@
@Nullable
public INBT func_218657_a(String p_218657_1_, INBT p_218657_2_) {
+ if (p_218657_2_ == null) throw new IllegalArgumentException("Invalid null NBT value with key " + p_218657_1_);
return this.field_74784_a.put(p_218657_1_, p_218657_2_);
}
@@ -408,11 +410,12 @@
}
private static byte func_152447_a(DataInput p_152447_0_, NBTSizeTracker p_152447_1_) throws IOException {
+ p_152447_1_.func_152450_a(8);
return p_152447_0_.readByte();
}
private static String func_152448_b(DataInput p_152448_0_, NBTSizeTracker p_152448_1_) throws IOException {
- return p_152448_0_.readUTF();
+ return p_152448_1_.readUTF(p_152448_0_.readUTF());
}
private static INBT func_229680_b_(INBTType<?> p_229680_0_, String p_229680_1_, DataInput p_229680_2_, int p_229680_3_, NBTSizeTracker p_229680_4_) {