3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-25 15:50:10 +01:00

Add debug to show metadata ID on error

Dieser Commit ist enthalten in:
Myles 2016-03-04 23:30:37 +00:00
Ursprung ac2178a247
Commit d5d8881677

Datei anzeigen

@ -117,7 +117,7 @@ public class MetadataRewriter {
} }
} catch (Exception e) { } catch (Exception e) {
if (type != null) { if (type != null) {
System.out.println("An error occurred with entity meta data for " + type); System.out.println("An error occurred with entity meta data for " + type + " OldID: " + entry.oldID);
if (metaIndex != null) { if (metaIndex != null) {
System.out.println("Old ID: " + metaIndex.getIndex() + " New ID: " + metaIndex.getNewIndex()); System.out.println("Old ID: " + metaIndex.getIndex() + " New ID: " + metaIndex.getNewIndex());
System.out.println("Old Type: " + metaIndex.getOldType() + " New Type: " + metaIndex.getNewType()); System.out.println("Old Type: " + metaIndex.getOldType() + " New Type: " + metaIndex.getNewType());
@ -138,23 +138,23 @@ public class MetadataRewriter {
MetaIndex index = MetaIndex.getIndex(entityType, id); MetaIndex index = MetaIndex.getIndex(entityType, id);
switch (type) { switch (type) {
case Byte: case Byte:
entries.add(new Entry(index, buf.readByte())); entries.add(new Entry(index, buf.readByte(), id));
break; break;
case Short: case Short:
entries.add(new Entry(index, buf.readShort())); entries.add(new Entry(index, buf.readShort(), id));
break; break;
case Int: case Int:
entries.add(new Entry(index, buf.readInt())); entries.add(new Entry(index, buf.readInt(), id));
break; break;
case Float: case Float:
entries.add(new Entry(index, buf.readFloat())); entries.add(new Entry(index, buf.readFloat(), id));
break; break;
case String: case String:
entries.add(new Entry(index, PacketUtil.readString(buf))); entries.add(new Entry(index, PacketUtil.readString(buf), id));
break; break;
case Slot: { case Slot: {
try { try {
entries.add(new Entry(index, ItemSlotRewriter.readItemStack(buf))); entries.add(new Entry(index, ItemSlotRewriter.readItemStack(buf), id));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -164,14 +164,14 @@ public class MetadataRewriter {
int x = buf.readInt(); int x = buf.readInt();
int y = buf.readInt(); int y = buf.readInt();
int z = buf.readInt(); int z = buf.readInt();
entries.add(new Entry(index, new Vector(x, y, z))); entries.add(new Entry(index, new Vector(x, y, z), id));
break; break;
} }
case Rotation: { case Rotation: {
float x = buf.readFloat(); float x = buf.readFloat();
float y = buf.readFloat(); float y = buf.readFloat();
float z = buf.readFloat(); float z = buf.readFloat();
entries.add(new Entry(index, new EulerAngle(x, y, z))); entries.add(new Entry(index, new EulerAngle(x, y, z), id));
break; break;
} }
default: default:
@ -184,12 +184,14 @@ public class MetadataRewriter {
public static class Entry { public static class Entry {
private final int oldID;
private MetaIndex index; private MetaIndex index;
private Object value; private Object value;
private Entry(MetaIndex index, Object value) { private Entry(MetaIndex index, Object value, int id) {
this.index = index; this.index = index;
this.value = value; this.value = value;
this.oldID = id;
} }
} }
} }