From ba08d4bde22c29ad80ecee62da0f4cf9617ec18b Mon Sep 17 00:00:00 2001 From: Richard Date: Thu, 28 Jan 2016 20:29:07 -0200 Subject: [PATCH] I have no idea how I did that. --- src/me/TheBukor/SkStuff/util/NBTUtil.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/me/TheBukor/SkStuff/util/NBTUtil.java b/src/me/TheBukor/SkStuff/util/NBTUtil.java index 74080a9..83466e3 100644 --- a/src/me/TheBukor/SkStuff/util/NBTUtil.java +++ b/src/me/TheBukor/SkStuff/util/NBTUtil.java @@ -20,8 +20,9 @@ public class NBTUtil { @SuppressWarnings("unchecked") public static void addCompound(Object NBT, Object toAdd) { if (NBT.getClass().getName().contains("NBTTagCompound") && toAdd.getClass().getName().contains("NBTTagCompound")) { + Field map = null; try { - Field map = nbtClass.getDeclaredField("map"); + map = nbtClass.getDeclaredField("map"); map.setAccessible(true); Set keySet = (Set) nbtClass.getMethod("c").invoke(toAdd); Iterator iterator = keySet.iterator(); @@ -33,7 +34,7 @@ public class NBTUtil { if((boolean) nbtClass.getMethod("hasKeyOfType", String.class, int.class).invoke(NBT, string, 10)) { Object localNBT = null; localNBT = nbtClass.getMethod("getCompound", String.class).invoke(localNBT, string); - NBTUtil.addCompound(localNBT.toString(), base.getClass().cast(nbtClass)); + NBTUtil.addCompound(localNBT, base.getClass().cast(nbtClass)); } else { nbtClass.getMethod("set", String.class, nbtBaseClass).invoke(NBT, string, base.getClass().getMethod("clone").invoke(base)); } @@ -43,6 +44,7 @@ public class NBTUtil { } map.setAccessible(false); } catch (Exception ex) { + map.setAccessible(false); ex.printStackTrace(); } }