Skip to content

Commit

Permalink
Fixed NBT support
Browse files Browse the repository at this point in the history
  • Loading branch information
BuildTools committed Jun 6, 2019
1 parent 3eb1f50 commit e3e78e0
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit e3e78e0

Please sign in to comment.