From 785f0664da323acc6c255d648a1a5e1a4b0d0407 Mon Sep 17 00:00:00 2001 From: Myles Date: Wed, 2 Mar 2016 19:42:14 +0000 Subject: [PATCH] Fix wither & add more debug info to missing metaindex --- .../us/myles/ViaVersion/metadata/MetaIndex.java | 2 ++ .../transformers/OutgoingTransformer.java | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/java/us/myles/ViaVersion/metadata/MetaIndex.java b/src/main/java/us/myles/ViaVersion/metadata/MetaIndex.java index 20116e829..0224f5401 100644 --- a/src/main/java/us/myles/ViaVersion/metadata/MetaIndex.java +++ b/src/main/java/us/myles/ViaVersion/metadata/MetaIndex.java @@ -88,6 +88,8 @@ public enum MetaIndex { WITHER_TARGET2(Wither.class, 18, Type.Int, 12, NewType.VarInt), WITHER_TARGET3(Wither.class, 19, Type.Int, 13, NewType.VarInt), WITHER_INVULN_TIME(Wither.class, 20, Type.Int, 14, NewType.VarInt), + // wither skull + WITHERSKULL_INVULN(WitherSkull.class, 10, Type.Byte, 5, NewType.Boolean), // guardian GUARDIAN_INFO(Guardian.class, 16, Type.Int, 11, NewType.Byte), GUARDIAN_TARGET(Guardian.class, 17, Type.Int, 12, NewType.VarInt), diff --git a/src/main/java/us/myles/ViaVersion/transformers/OutgoingTransformer.java b/src/main/java/us/myles/ViaVersion/transformers/OutgoingTransformer.java index 3f28e184f..1f2fca030 100644 --- a/src/main/java/us/myles/ViaVersion/transformers/OutgoingTransformer.java +++ b/src/main/java/us/myles/ViaVersion/transformers/OutgoingTransformer.java @@ -551,6 +551,17 @@ public class OutgoingTransformer { } catch (IllegalAccessException e) { e.printStackTrace(); } + if (metaIndex == null) { + try { + System.out.println("Meta Data for " + type + ": Not found, ID: " + (int) ReflectionUtil.invoke(watchableObj, "a")); + } catch (NoSuchMethodException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + } try { if (metaIndex.getNewType() != NewType.Discontinued) { if (metaIndex.getNewType() != NewType.BlockID || id != -1 && data == -1 || id == -1 && data != -1) { // block ID is only written if we have both parts @@ -635,8 +646,10 @@ public class OutgoingTransformer { } catch (Exception e) { if (type != null) { System.out.println("An error occurred with entity meta data for " + type); - System.out.println("Old ID: " + metaIndex.getIndex() + " New ID: " + metaIndex.getNewIndex()); - System.out.println("Old Type: " + metaIndex.getOldType() + " New Type: " + metaIndex.getNewType()); + if (metaIndex != null) { + System.out.println("Old ID: " + metaIndex.getIndex() + " New ID: " + metaIndex.getNewIndex()); + System.out.println("Old Type: " + metaIndex.getOldType() + " New Type: " + metaIndex.getNewType()); + } } e.printStackTrace(); }