3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 08:30:09 +01:00

Fix shields not being for the right entity >.> and also print out value for metadata

Dieser Commit ist enthalten in:
Myles 2016-03-26 13:07:06 +00:00
Ursprung f32d3211ed
Commit f371419396
2 geänderte Dateien mit 120 neuen und 111 gelöschten Zeilen

Datei anzeigen

@ -21,6 +21,7 @@ public class MetadataRewriter {
for (Metadata entry : new ArrayList<>(list)) { for (Metadata entry : new ArrayList<>(list)) {
MetaIndex metaIndex = MetaIndex.getIndex(type, entry.getId()); MetaIndex metaIndex = MetaIndex.getIndex(type, entry.getId());
try { try {
if (metaIndex != null) {
if (metaIndex.getNewType() != NewType.Discontinued) { 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 if (metaIndex.getNewType() != NewType.BlockID || id != -1 && data == -1 || id == -1 && data != -1) { // block ID is only written if we have both parts
entry.setId(metaIndex.getNewIndex()); entry.setId(metaIndex.getNewIndex());
@ -135,6 +136,9 @@ public class MetadataRewriter {
} else { } else {
list.remove(entry); list.remove(entry);
} }
} else {
throw new Exception("Could not find valid metadata");
}
} catch (Exception e) { } catch (Exception e) {
list.remove(entry); list.remove(entry);
if (!((ViaVersionPlugin) ViaVersion.getInstance()).isSuppressMetadataErrors()) { if (!((ViaVersionPlugin) ViaVersion.getInstance()).isSuppressMetadataErrors()) {
@ -144,6 +148,7 @@ public class MetadataRewriter {
else else
System.out.println("An error occurred with entity meta data for UNKNOWN_ENTITY OldID: " + entry.getId()); System.out.println("An error occurred with entity meta data for UNKNOWN_ENTITY OldID: " + entry.getId());
if (metaIndex != null) { if (metaIndex != null) {
System.out.println("Value: " + entry.getValue());
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());
} }

Datei anzeigen

@ -54,6 +54,10 @@ public class EntityTracker extends StoredObject {
} }
public void setSecondHand(Item item) { public void setSecondHand(Item item) {
setSecondHand(entityID, item);
}
public void setSecondHand(int entityID, Item item) {
PacketWrapper wrapper = new PacketWrapper(0x3C, null, getUser()); PacketWrapper wrapper = new PacketWrapper(0x3C, null, getUser());
wrapper.write(Type.VAR_INT, entityID); wrapper.write(Type.VAR_INT, entityID);
wrapper.write(Type.VAR_INT, 1); // slot wrapper.write(Type.VAR_INT, 1); // slot
@ -106,10 +110,10 @@ public class EntityTracker extends StoredObject {
if ((data & 0x10) == 0x10) { if ((data & 0x10) == 0x10) {
if (validBlocking.contains(entityID)) { if (validBlocking.contains(entityID)) {
Item shield = new Item((short) 442, (byte) 1, (short) 0, null); Item shield = new Item((short) 442, (byte) 1, (short) 0, null);
setSecondHand(shield); setSecondHand(entityID, shield);
} }
} else { } else {
setSecondHand(null); setSecondHand(entityID, null);
} }
} }
} }