Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 16:12:42 +01:00
Fix shields not being for the right entity >.> and also print out value for metadata
Dieser Commit ist enthalten in:
Ursprung
f32d3211ed
Commit
f371419396
@ -21,6 +21,7 @@ public class MetadataRewriter {
|
||||
for (Metadata entry : new ArrayList<>(list)) {
|
||||
MetaIndex metaIndex = MetaIndex.getIndex(type, entry.getId());
|
||||
try {
|
||||
if (metaIndex != null) {
|
||||
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
|
||||
entry.setId(metaIndex.getNewIndex());
|
||||
@ -135,6 +136,9 @@ public class MetadataRewriter {
|
||||
} else {
|
||||
list.remove(entry);
|
||||
}
|
||||
} else {
|
||||
throw new Exception("Could not find valid metadata");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
list.remove(entry);
|
||||
if (!((ViaVersionPlugin) ViaVersion.getInstance()).isSuppressMetadataErrors()) {
|
||||
@ -144,6 +148,7 @@ public class MetadataRewriter {
|
||||
else
|
||||
System.out.println("An error occurred with entity meta data for UNKNOWN_ENTITY OldID: " + entry.getId());
|
||||
if (metaIndex != null) {
|
||||
System.out.println("Value: " + entry.getValue());
|
||||
System.out.println("Old ID: " + metaIndex.getIndex() + " New ID: " + metaIndex.getNewIndex());
|
||||
System.out.println("Old Type: " + metaIndex.getOldType() + " New Type: " + metaIndex.getNewType());
|
||||
}
|
||||
|
@ -54,6 +54,10 @@ public class EntityTracker extends StoredObject {
|
||||
}
|
||||
|
||||
public void setSecondHand(Item item) {
|
||||
setSecondHand(entityID, item);
|
||||
}
|
||||
|
||||
public void setSecondHand(int entityID, Item item) {
|
||||
PacketWrapper wrapper = new PacketWrapper(0x3C, null, getUser());
|
||||
wrapper.write(Type.VAR_INT, entityID);
|
||||
wrapper.write(Type.VAR_INT, 1); // slot
|
||||
@ -106,10 +110,10 @@ public class EntityTracker extends StoredObject {
|
||||
if ((data & 0x10) == 0x10) {
|
||||
if (validBlocking.contains(entityID)) {
|
||||
Item shield = new Item((short) 442, (byte) 1, (short) 0, null);
|
||||
setSecondHand(shield);
|
||||
setSecondHand(entityID, shield);
|
||||
}
|
||||
} else {
|
||||
setSecondHand(null);
|
||||
setSecondHand(entityID, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren