mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-09-28 22:47:40 +02:00
Remove redundant tags
This commit is contained in:
parent
fdc4d2c5d2
commit
4e2156bd2b
@ -64,7 +64,8 @@ public class SpawnEggRewriter {
|
|||||||
public static int getSpawnEggId(String entityIdentifier) {
|
public static int getSpawnEggId(String entityIdentifier) {
|
||||||
// Fallback to bat
|
// Fallback to bat
|
||||||
if (!spawnEggs.containsKey(entityIdentifier))
|
if (!spawnEggs.containsKey(entityIdentifier))
|
||||||
return 25100288;
|
//return 25100288;
|
||||||
|
return -1;
|
||||||
return (383 << 16 | (spawnEggs.get(entityIdentifier) & 0xFFFF));
|
return (383 << 16 | (spawnEggs.get(entityIdentifier) & 0xFFFF));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,6 +265,8 @@ public class InventoryPackets {
|
|||||||
// Save original id
|
// Save original id
|
||||||
int originalId = (item.getId() << 16 | item.getData() & 0xFFFF);
|
int originalId = (item.getId() << 16 | item.getData() & 0xFFFF);
|
||||||
|
|
||||||
|
int rawId = (item.getId() << 4 | item.getData() & 0xF);
|
||||||
|
|
||||||
// NBT Additions
|
// NBT Additions
|
||||||
if (isDamageable(item.getId())) {
|
if (isDamageable(item.getId())) {
|
||||||
if (tag == null) item.setTag(tag = new CompoundTag("tag"));
|
if (tag == null) item.setTag(tag = new CompoundTag("tag"));
|
||||||
@ -343,24 +345,31 @@ public class InventoryPackets {
|
|||||||
tag.remove("StoredEnchantments");
|
tag.remove("StoredEnchantments");
|
||||||
tag.put(newStoredEnch);
|
tag.put(newStoredEnch);
|
||||||
}
|
}
|
||||||
}
|
// Handle SpawnEggs
|
||||||
|
if (item.getId() == 383) {
|
||||||
int rawId = (item.getId() << 4 | item.getData() & 0xF);
|
if (tag.get("EntityTag") instanceof CompoundTag) {
|
||||||
|
CompoundTag entityTag = tag.get("EntityTag");
|
||||||
// Handle SpawnEggs
|
if (entityTag.get("id") instanceof StringTag) {
|
||||||
if (item.getId() == 383) {
|
StringTag identifier = entityTag.get("id");
|
||||||
if (tag != null && tag.get("EntityTag") instanceof CompoundTag) {
|
rawId = SpawnEggRewriter.getSpawnEggId(identifier.getValue());
|
||||||
CompoundTag entityTag = tag.get("EntityTag");
|
if (rawId == -1) {
|
||||||
if (entityTag.get("id") instanceof StringTag) {
|
rawId = 25100288; // Bat fallback
|
||||||
StringTag identifier = entityTag.get("id");
|
} else {
|
||||||
rawId = SpawnEggRewriter.getSpawnEggId(identifier.getValue());
|
entityTag.remove("id");
|
||||||
|
if (entityTag.isEmpty())
|
||||||
|
tag.remove("EntityTag");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Fallback to bat
|
||||||
|
rawId = 25100288;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Fallback to bat
|
// Fallback to bat
|
||||||
rawId = 25100288;
|
rawId = 25100288;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
// Fallback to bat
|
if (tag.isEmpty()) {
|
||||||
rawId = 25100288;
|
item.setTag(tag = null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user