Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-03 14:50:30 +01:00
Remove redundant tags
Dieser Commit ist enthalten in:
Ursprung
fdc4d2c5d2
Commit
4e2156bd2b
@ -64,7 +64,8 @@ public class SpawnEggRewriter {
|
||||
public static int getSpawnEggId(String entityIdentifier) {
|
||||
// Fallback to bat
|
||||
if (!spawnEggs.containsKey(entityIdentifier))
|
||||
return 25100288;
|
||||
//return 25100288;
|
||||
return -1;
|
||||
return (383 << 16 | (spawnEggs.get(entityIdentifier) & 0xFFFF));
|
||||
}
|
||||
|
||||
|
@ -265,6 +265,8 @@ public class InventoryPackets {
|
||||
// Save original id
|
||||
int originalId = (item.getId() << 16 | item.getData() & 0xFFFF);
|
||||
|
||||
int rawId = (item.getId() << 4 | item.getData() & 0xF);
|
||||
|
||||
// NBT Additions
|
||||
if (isDamageable(item.getId())) {
|
||||
if (tag == null) item.setTag(tag = new CompoundTag("tag"));
|
||||
@ -343,17 +345,20 @@ public class InventoryPackets {
|
||||
tag.remove("StoredEnchantments");
|
||||
tag.put(newStoredEnch);
|
||||
}
|
||||
}
|
||||
|
||||
int rawId = (item.getId() << 4 | item.getData() & 0xF);
|
||||
|
||||
// Handle SpawnEggs
|
||||
if (item.getId() == 383) {
|
||||
if (tag != null && tag.get("EntityTag") instanceof CompoundTag) {
|
||||
if (tag.get("EntityTag") instanceof CompoundTag) {
|
||||
CompoundTag entityTag = tag.get("EntityTag");
|
||||
if (entityTag.get("id") instanceof StringTag) {
|
||||
StringTag identifier = entityTag.get("id");
|
||||
rawId = SpawnEggRewriter.getSpawnEggId(identifier.getValue());
|
||||
if (rawId == -1) {
|
||||
rawId = 25100288; // Bat fallback
|
||||
} else {
|
||||
entityTag.remove("id");
|
||||
if (entityTag.isEmpty())
|
||||
tag.remove("EntityTag");
|
||||
}
|
||||
} else {
|
||||
// Fallback to bat
|
||||
rawId = 25100288;
|
||||
@ -363,6 +368,10 @@ public class InventoryPackets {
|
||||
rawId = 25100288;
|
||||
}
|
||||
}
|
||||
if (tag.isEmpty()) {
|
||||
item.setTag(tag = null);
|
||||
}
|
||||
}
|
||||
|
||||
if (!MappingData.oldToNewItems.containsKey(rawId)) {
|
||||
if (!isDamageable(item.getId()) && item.getId() != 358) { // Map
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren