From e3e78e02727eaf2b8e5593266db328055fe11cf6 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 6 Jun 2019 09:24:25 -0400 Subject: [PATCH] Fixed NBT support --- .../me/rayzr522/lib/comphenix/attribute/NbtFactory.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/java/me/rayzr522/lib/comphenix/attribute/NbtFactory.java b/src/main/java/me/rayzr522/lib/comphenix/attribute/NbtFactory.java index e9d28cb..486f64f 100644 --- a/src/main/java/me/rayzr522/lib/comphenix/attribute/NbtFactory.java +++ b/src/main/java/me/rayzr522/lib/comphenix/attribute/NbtFactory.java @@ -95,12 +95,8 @@ private NbtFactory() { // Prepare NBT COMPOUND_CLASS = getMethod(0, Modifier.STATIC, offlinePlayer, "getData").getReturnType(); - if (majorVersion >= 13) { - // 1.13 compat - BASE_CLASS = COMPOUND_CLASS.getInterfaces()[0]; - } else { - BASE_CLASS = COMPOUND_CLASS.getSuperclass(); - } + String nmsPackage = COMPOUND_CLASS.getPackage().getName(); + BASE_CLASS = loader.loadClass(nmsPackage + ".NBTBase"); NBT_GET_TYPE = getMethod(0, Modifier.STATIC, BASE_CLASS, "getTypeId"); NBT_CREATE_TAG = getMethod(Modifier.STATIC, 0, BASE_CLASS, "createTag", byte.class); @@ -111,7 +107,6 @@ private NbtFactory() { STACK_TAG = getField(null, CRAFT_HANDLE.getType(), "tag"); // Loading/saving - String nmsPackage = BASE_CLASS.getPackage().getName(); initializeNMS(loader, nmsPackage); LOAD_COMPOUND = READ_LIMITER_CLASS != null ? new LoadMethodSkinUpdate(STREAM_TOOLS, READ_LIMITER_CLASS) : new LoadMethodWorldUpdate(STREAM_TOOLS);