From 4eab54a382d5588bcc8f17b6b91b3417a54c8a07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9trus=20Pradella?= Date: Tue, 19 Apr 2022 05:45:04 -0300 Subject: [PATCH] Revert "Revert "Add function to merge NBTTagCompound, its present on modern versions, it might help compatibility with a few plugins."" We can keep "merge" function, we just can't edit any other. This reverts commit 73744e8c83d3ae7a2a8bd1ac3cadff8c288ad455. --- .../minecraft/nbt/NBTTagCompound.java.patch | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/patches/net/minecraft/nbt/NBTTagCompound.java.patch b/patches/net/minecraft/nbt/NBTTagCompound.java.patch index 79a34218..de1970f3 100644 --- a/patches/net/minecraft/nbt/NBTTagCompound.java.patch +++ b/patches/net/minecraft/nbt/NBTTagCompound.java.patch @@ -134,11 +134,39 @@ return nbttagcompound; } -@@ -407,4 +418,29 @@ +@@ -407,4 +418,57 @@ throw new ReportedException(crashreport); } } + ++ /** ++ * Merges copies of data contained in {@code other} into this compound tag. ++ */ ++ public void merge(NBTTagCompound other) ++ { ++ for (String s : other.tagMap.keySet()) ++ { ++ NBTBase nbtbase = other.tagMap.get(s); ++ ++ if (nbtbase.getId() == 10) ++ { ++ if (this.hasKey(s, 10)) ++ { ++ NBTTagCompound nbttagcompound = this.getCompoundTag(s); ++ nbttagcompound.merge((NBTTagCompound)nbtbase); ++ } ++ else ++ { ++ this.setTag(s, nbtbase.copy()); ++ } ++ } ++ else ++ { ++ this.setTag(s, nbtbase.copy()); ++ } ++ } ++ } ++ + @Override + public String crucible_toString() + {