From becba6498e4cc066204b69ec4a9dd312d6ae9e0f Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Sat, 13 Nov 2021 11:06:59 +0100 Subject: [PATCH] Make mapped entity names configurable --- .../api/data/BackwardsMappings.java | 12 ++++- .../api/data/VBMappingDataLoader.java | 14 ++++-- .../api/entities/storage/EntityData.java | 48 +++++++++++++++---- .../entities/storage/EntityObjectData.java | 10 ++-- .../api/rewriters/EntityRewriterBase.java | 2 +- .../api/rewriters/LegacyEntityRewriter.java | 2 +- .../packets/EntityPackets1_11.java | 14 +++--- .../Protocol1_11_1To1_12.java | 17 +++++++ .../packets/EntityPackets1_12.java | 4 +- .../packets/EntityPackets1_13.java | 16 +++---- .../packets/EntityPackets1_14.java | 14 +++--- .../packets/EntityPackets1_15.java | 2 +- .../packets/EntityPackets1_16.java | 8 ++-- .../packets/EntityPackets1_16_2.java | 2 +- .../packets/EntityPackets1_17.java | 6 +-- .../packets/EntityPackets1_10.java | 2 +- .../viabackwards/data/mapping-1.10to1.11.json | 9 ++++ .../viabackwards/data/mapping-1.11to1.12.json | 4 ++ .../viabackwards/data/mapping-1.12to1.13.json | 10 ++++ .../data/mapping-1.13.2to1.14.json | 11 ++++- .../viabackwards/data/mapping-1.14to1.15.json | 3 ++ .../viabackwards/data/mapping-1.15to1.16.json | 6 +++ .../data/mapping-1.16.2to1.17.json | 6 ++- .../data/mapping-1.16to1.16.2.json | 3 ++ .../data/mapping-1.9.4to1.10.json | 3 ++ 25 files changed, 171 insertions(+), 57 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/api/data/BackwardsMappings.java b/common/src/main/java/com/viaversion/viabackwards/api/data/BackwardsMappings.java index f351a70f..bdc2d59d 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/data/BackwardsMappings.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/data/BackwardsMappings.java @@ -36,6 +36,7 @@ public class BackwardsMappings extends MappingDataBase { private final Class vvProtocolClass; private Int2ObjectMap backwardsItemMappings; private Map backwardsSoundMappings; + private Map entityNames; public BackwardsMappings(String oldVersion, String newVersion, @Nullable Class vvProtocolClass) { this(oldVersion, newVersion, vvProtocolClass, false); @@ -60,7 +61,12 @@ public class BackwardsMappings extends MappingDataBase { JsonObject diffSounds = diffMappings.getAsJsonObject("sounds"); if (diffSounds != null) { - backwardsSoundMappings = VBMappingDataLoader.objectToMap(diffSounds); + backwardsSoundMappings = VBMappingDataLoader.objectToNamespacedMap(diffSounds); + } + + JsonObject diffEntityNames = diffMappings.getAsJsonObject("entitynames"); + if (diffEntityNames != null) { + entityNames = VBMappingDataLoader.objectToMap(diffEntityNames); } } @@ -145,6 +151,10 @@ public class BackwardsMappings extends MappingDataBase { return backwardsSoundMappings.get(id); } + public @Nullable String mappedEntityName(String entityName) { + return entityNames.get(entityName); + } + public @Nullable Int2ObjectMap getBackwardsItemMappings() { return backwardsItemMappings; } diff --git a/common/src/main/java/com/viaversion/viabackwards/api/data/VBMappingDataLoader.java b/common/src/main/java/com/viaversion/viabackwards/api/data/VBMappingDataLoader.java index f27bfec8..cfcd4ff2 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/data/VBMappingDataLoader.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/data/VBMappingDataLoader.java @@ -73,7 +73,7 @@ public class VBMappingDataLoader { } public static void mapIdentifiers(int[] output, JsonObject oldIdentifiers, JsonObject newIdentifiers, JsonObject diffIdentifiers, boolean warnOnMissing) { - Object2IntMap newIdentifierMap = MappingDataLoader.indexedObjectToMap(newIdentifiers); + Object2IntMap newIdentifierMap = MappingDataLoader.indexedObjectToMap(newIdentifiers); for (Map.Entry entry : oldIdentifiers.entrySet()) { String key = entry.getValue().getAsString(); int mappedId = newIdentifierMap.getInt(key); @@ -113,8 +113,8 @@ public class VBMappingDataLoader { } } - public static Map objectToMap(JsonObject object) { - Map mappings = new HashMap<>(); + public static Map objectToNamespacedMap(JsonObject object) { + Map mappings = new HashMap<>(object.size()); for (Map.Entry entry : object.entrySet()) { String key = entry.getKey(); if (key.indexOf(':') == -1) { @@ -129,6 +129,14 @@ public class VBMappingDataLoader { return mappings; } + public static Map objectToMap(JsonObject object) { + Map mappings = new HashMap<>(object.size()); + for (Map.Entry entry : object.entrySet()) { + mappings.put(entry.getKey(), entry.getValue().getAsString()); + } + return mappings; + } + public static Int2ObjectMap loadItemMappings(JsonObject oldMapping, JsonObject newMapping, JsonObject diffMapping) { return loadItemMappings(oldMapping, newMapping, diffMapping, false); } diff --git a/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/EntityData.java b/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/EntityData.java index 9736c530..78973338 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/EntityData.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/EntityData.java @@ -18,27 +18,40 @@ package com.viaversion.viabackwards.api.entities.storage; +import com.viaversion.viabackwards.ViaBackwards; +import com.viaversion.viabackwards.api.BackwardsProtocol; +import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ChatRewriter; import org.checkerframework.checker.nullness.qual.Nullable; +import java.util.Locale; + public class EntityData { + private final BackwardsProtocol protocol; private final int id; private final int replacementId; - private Object mobName; + private final String key; + private NameVisibility nameVisibility = NameVisibility.NONE; private MetaCreator defaultMeta; - public EntityData(int id, int replacementId) { - this.id = id; - this.replacementId = replacementId; + public EntityData(BackwardsProtocol protocol, EntityType type, int replacementId) { + this(protocol, type.name(), type.getId(), replacementId); } - public EntityData jsonName(String name) { - this.mobName = ChatRewriter.legacyTextToJson(name); + public EntityData(BackwardsProtocol protocol, String key, int id, int replacementId) { + this.protocol = protocol; + this.id = id; + this.replacementId = replacementId; + this.key = key.toLowerCase(Locale.ROOT); + } + + public EntityData jsonName() { + this.nameVisibility = NameVisibility.JSON; return this; } - public EntityData mobName(String name) { - this.mobName = name; + public EntityData plainName() { + this.nameVisibility = NameVisibility.PLAIN; return this; } @@ -59,7 +72,16 @@ public class EntityData { * @return custom mobname, can be either a String or a JsonElement */ public @Nullable Object mobName() { - return mobName; + if (nameVisibility == NameVisibility.NONE) { + return null; + } + + String name = protocol.getMappingData().mappedEntityName(key); + if (name == null) { + ViaBackwards.getPlatform().getLogger().warning("Entity name for " + key + " not found in protocol " + protocol.getClass().getSimpleName()); + name = key; + } + return nameVisibility == NameVisibility.JSON ? ChatRewriter.legacyTextToJson(name) : name; } public int replacementId() { @@ -82,7 +104,7 @@ public class EntityData { public String toString() { return "EntityData{" + "id=" + id + - ", mobName='" + mobName + '\'' + + ", mobName='" + key + '\'' + ", replacementId=" + replacementId + ", defaultMeta=" + defaultMeta + '}'; @@ -93,4 +115,10 @@ public class EntityData { void createMeta(WrappedMetadata storage); } + + private enum NameVisibility { + PLAIN, + JSON, + NONE + } } diff --git a/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/EntityObjectData.java b/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/EntityObjectData.java index 5bd9cb05..3a35f94d 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/EntityObjectData.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/EntityObjectData.java @@ -17,19 +17,19 @@ */ package com.viaversion.viabackwards.api.entities.storage; +import com.viaversion.viabackwards.api.BackwardsProtocol; + public class EntityObjectData extends EntityData { - private final boolean isObject; private final int objectData; - public EntityObjectData(int id, boolean isObject, int replacementId, int objectData) { - super(id, replacementId); - this.isObject = isObject; + public EntityObjectData(BackwardsProtocol protocol, String key, int id, int replacementId, int objectData) { + super(protocol, key, id, replacementId); this.objectData = objectData; } @Override public boolean isObjectType() { - return isObject; + return true; } @Override diff --git a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/EntityRewriterBase.java b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/EntityRewriterBase.java index 5b3f6df8..e5bb86f4 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/EntityRewriterBase.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/EntityRewriterBase.java @@ -131,7 +131,7 @@ public abstract class EntityRewriterBase extends En // Already rewrite the id here int mappedReplacementId = newEntityId(mappedType.getId()); - EntityData data = new EntityData(type.getId(), mappedReplacementId); + EntityData data = new EntityData(protocol, type, mappedReplacementId); mapEntityType(type.getId(), mappedReplacementId); entityDataMappings.put(type.getId(), data); return data; diff --git a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/LegacyEntityRewriter.java b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/LegacyEntityRewriter.java index 2a6993e4..91798e96 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/LegacyEntityRewriter.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/LegacyEntityRewriter.java @@ -52,7 +52,7 @@ public abstract class LegacyEntityRewriter extends } protected EntityObjectData mapObjectType(ObjectType oldObjectType, ObjectType replacement, int data) { - EntityObjectData entData = new EntityObjectData(oldObjectType.getId(), true, replacement.getId(), data); + EntityObjectData entData = new EntityObjectData(protocol, oldObjectType.getType().name(), oldObjectType.getId(), replacement.getId(), data); objectTypes.put(oldObjectType, entData); return entData; } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_10to1_11/packets/EntityPackets1_11.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_10to1_11/packets/EntityPackets1_11.java index 60b5cdb9..6129c6f3 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_10to1_11/packets/EntityPackets1_11.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_10to1_11/packets/EntityPackets1_11.java @@ -215,10 +215,10 @@ public class EntityPackets1_11 extends LegacyEntityRewriter // Guardian mapEntityTypeWithData(Entity1_11Types.EntityType.ELDER_GUARDIAN, Entity1_11Types.EntityType.GUARDIAN); // Skeletons - mapEntityTypeWithData(Entity1_11Types.EntityType.WITHER_SKELETON, Entity1_11Types.EntityType.SKELETON).mobName("Wither Skeleton").spawnMetadata(storage -> storage.add(getSkeletonTypeMeta(1))); - mapEntityTypeWithData(Entity1_11Types.EntityType.STRAY, Entity1_11Types.EntityType.SKELETON).mobName("Stray").spawnMetadata(storage -> storage.add(getSkeletonTypeMeta(2))); + mapEntityTypeWithData(Entity1_11Types.EntityType.WITHER_SKELETON, Entity1_11Types.EntityType.SKELETON).plainName().spawnMetadata(storage -> storage.add(getSkeletonTypeMeta(1))); + mapEntityTypeWithData(Entity1_11Types.EntityType.STRAY, Entity1_11Types.EntityType.SKELETON).plainName().spawnMetadata(storage -> storage.add(getSkeletonTypeMeta(2))); // Zombies - mapEntityTypeWithData(Entity1_11Types.EntityType.HUSK, Entity1_11Types.EntityType.ZOMBIE).mobName("Husk").spawnMetadata(storage -> handleZombieType(storage, 6)); + mapEntityTypeWithData(Entity1_11Types.EntityType.HUSK, Entity1_11Types.EntityType.ZOMBIE).plainName().spawnMetadata(storage -> handleZombieType(storage, 6)); mapEntityTypeWithData(Entity1_11Types.EntityType.ZOMBIE_VILLAGER, Entity1_11Types.EntityType.ZOMBIE).spawnMetadata(storage -> handleZombieType(storage, 1)); // Horses mapEntityTypeWithData(Entity1_11Types.EntityType.HORSE, Entity1_11Types.EntityType.HORSE).spawnMetadata(storage -> storage.add(getHorseMetaType(0))); // Nob able to ride the horse without having the MetaType sent. @@ -228,10 +228,10 @@ public class EntityPackets1_11 extends LegacyEntityRewriter mapEntityTypeWithData(Entity1_11Types.EntityType.ZOMBIE_HORSE, Entity1_11Types.EntityType.HORSE).spawnMetadata(storage -> storage.add(getHorseMetaType(3))); // New mobs mapEntityTypeWithData(Entity1_11Types.EntityType.EVOCATION_FANGS, Entity1_11Types.EntityType.SHULKER); - mapEntityTypeWithData(Entity1_11Types.EntityType.EVOCATION_ILLAGER, Entity1_11Types.EntityType.VILLAGER).mobName("Evoker"); - mapEntityTypeWithData(Entity1_11Types.EntityType.VEX, Entity1_11Types.EntityType.BAT).mobName("Vex"); - mapEntityTypeWithData(Entity1_11Types.EntityType.VINDICATION_ILLAGER, Entity1_11Types.EntityType.VILLAGER).mobName("Vindicator").spawnMetadata(storage -> storage.add(new Metadata(13, MetaType1_9.VarInt, 4))); // Base Profession - mapEntityTypeWithData(Entity1_11Types.EntityType.LIAMA, Entity1_11Types.EntityType.HORSE).mobName("Llama").spawnMetadata(storage -> storage.add(getHorseMetaType(1))); + mapEntityTypeWithData(Entity1_11Types.EntityType.EVOCATION_ILLAGER, Entity1_11Types.EntityType.VILLAGER).plainName(); + mapEntityTypeWithData(Entity1_11Types.EntityType.VEX, Entity1_11Types.EntityType.BAT).plainName(); + mapEntityTypeWithData(Entity1_11Types.EntityType.VINDICATION_ILLAGER, Entity1_11Types.EntityType.VILLAGER).plainName().spawnMetadata(storage -> storage.add(new Metadata(13, MetaType1_9.VarInt, 4))); // Base Profession + mapEntityTypeWithData(Entity1_11Types.EntityType.LIAMA, Entity1_11Types.EntityType.HORSE).plainName().spawnMetadata(storage -> storage.add(getHorseMetaType(1))); mapEntityTypeWithData(Entity1_11Types.EntityType.LIAMA_SPIT, Entity1_11Types.EntityType.SNOWBALL); mapObjectType(Entity1_11Types.ObjectType.LIAMA_SPIT, Entity1_11Types.ObjectType.SNOWBALL, -1); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/Protocol1_11_1To1_12.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/Protocol1_11_1To1_12.java index ac755827..c9285e45 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/Protocol1_11_1To1_12.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/Protocol1_11_1To1_12.java @@ -19,6 +19,7 @@ package com.viaversion.viabackwards.protocol.protocol1_11_1to1_12; import com.viaversion.viabackwards.api.BackwardsProtocol; +import com.viaversion.viabackwards.api.data.BackwardsMappings; import com.viaversion.viabackwards.protocol.protocol1_11_1to1_12.data.ShoulderTracker; import com.viaversion.viabackwards.protocol.protocol1_11_1to1_12.packets.BlockItemPackets1_12; import com.viaversion.viabackwards.protocol.protocol1_11_1to1_12.packets.ChatPackets1_12; @@ -39,6 +40,12 @@ import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8; public class Protocol1_11_1To1_12 extends BackwardsProtocol { + private static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.12", "1.11", null, true) { + @Override + protected boolean shouldWarnOnMissing(final String key) { + return super.shouldWarnOnMissing(key) && !key.equals("sounds"); + } + }; private final EntityPackets1_12 entityPackets = new EntityPackets1_12(this); private final BlockItemPackets1_12 blockItemPackets = new BlockItemPackets1_12(this); @@ -83,6 +90,11 @@ public class Protocol1_11_1To1_12 extends BackwardsProtocol storage.add(new Metadata(12, MetaType1_12.Byte, (byte) 0x00))); - mapEntityTypeWithData(Entity1_12Types.EntityType.ILLUSION_ILLAGER, Entity1_12Types.EntityType.EVOCATION_ILLAGER).mobName("Illusioner"); + mapEntityTypeWithData(Entity1_12Types.EntityType.PARROT, Entity1_12Types.EntityType.BAT).plainName().spawnMetadata(storage -> storage.add(new Metadata(12, MetaType1_12.Byte, (byte) 0x00))); + mapEntityTypeWithData(Entity1_12Types.EntityType.ILLUSION_ILLAGER, Entity1_12Types.EntityType.EVOCATION_ILLAGER).plainName(); // Handle Illager filter().filterFamily(Entity1_12Types.EntityType.EVOCATION_ILLAGER).cancel(12); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/EntityPackets1_13.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/EntityPackets1_13.java index afac43e0..8c97f2c6 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/EntityPackets1_13.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/EntityPackets1_13.java @@ -281,25 +281,25 @@ public class EntityPackets1_13 extends LegacyEntityRewriter { + mapEntityTypeWithData(Entity1_13Types.EntityType.PHANTOM, Entity1_13Types.EntityType.PARROT).plainName().spawnMetadata(storage -> { // The phantom is grey/blue so let's do yellow/blue storage.add(new Metadata(15, MetaType1_12.VarInt, 3)); }); // Dolphin - mapEntityTypeWithData(Entity1_13Types.EntityType.DOLPHIN, Entity1_13Types.EntityType.SQUID).mobName("Dolphin"); + mapEntityTypeWithData(Entity1_13Types.EntityType.DOLPHIN, Entity1_13Types.EntityType.SQUID).plainName(); // Turtle - mapEntityTypeWithData(Entity1_13Types.EntityType.TURTLE, Entity1_13Types.EntityType.OCELOT).mobName("Turtle"); + mapEntityTypeWithData(Entity1_13Types.EntityType.TURTLE, Entity1_13Types.EntityType.OCELOT).plainName(); // Rewrite Meta types filter().handler((event, meta) -> { diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/EntityPackets1_14.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/EntityPackets1_14.java index 8214fe04..8a7f1463 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/EntityPackets1_14.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/EntityPackets1_14.java @@ -352,13 +352,13 @@ public class EntityPackets1_14 extends LegacyEntityRewriter { int typeId = meta.metaType().typeId(); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_4to1_15/packets/EntityPackets1_15.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_4to1_15/packets/EntityPackets1_15.java index 78a242f3..81e074ae 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_4to1_15/packets/EntityPackets1_15.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_4to1_15/packets/EntityPackets1_15.java @@ -205,7 +205,7 @@ public class EntityPackets1_15 extends EntityRewriter { filter().type(Entity1_15Types.BEE).cancel(15); filter().type(Entity1_15Types.BEE).cancel(16); - mapEntityTypeWithData(Entity1_15Types.BEE, Entity1_15Types.PUFFERFISH).jsonName("Bee").spawnMetadata(storage -> { + mapEntityTypeWithData(Entity1_15Types.BEE, Entity1_15Types.PUFFERFISH).jsonName().spawnMetadata(storage -> { storage.add(new Metadata(14, Types1_14.META_TYPES.booleanType, false)); storage.add(new Metadata(15, Types1_14.META_TYPES.varIntType, 2)); }); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_15_2to1_16/packets/EntityPackets1_16.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_15_2to1_16/packets/EntityPackets1_16.java index 49ba0eda..70cf3ecb 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_15_2to1_16/packets/EntityPackets1_16.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_15_2to1_16/packets/EntityPackets1_16.java @@ -270,10 +270,10 @@ public class EntityPackets1_16 extends EntityRewriter { mapEntityType(Entity1_16Types.ZOMBIFIED_PIGLIN, Entity1_15Types.ZOMBIE_PIGMAN); mapTypes(Entity1_16Types.values(), Entity1_15Types.class); - mapEntityTypeWithData(Entity1_16Types.HOGLIN, Entity1_16Types.COW).jsonName("Hoglin"); - mapEntityTypeWithData(Entity1_16Types.ZOGLIN, Entity1_16Types.COW).jsonName("Zoglin"); - mapEntityTypeWithData(Entity1_16Types.PIGLIN, Entity1_16Types.ZOMBIFIED_PIGLIN).jsonName("Piglin"); - mapEntityTypeWithData(Entity1_16Types.STRIDER, Entity1_16Types.MAGMA_CUBE).jsonName("Strider"); + mapEntityTypeWithData(Entity1_16Types.HOGLIN, Entity1_16Types.COW).jsonName(); + mapEntityTypeWithData(Entity1_16Types.ZOGLIN, Entity1_16Types.COW).jsonName(); + mapEntityTypeWithData(Entity1_16Types.PIGLIN, Entity1_16Types.ZOMBIFIED_PIGLIN).jsonName(); + mapEntityTypeWithData(Entity1_16Types.STRIDER, Entity1_16Types.MAGMA_CUBE).jsonName(); filter().type(Entity1_16Types.ZOGLIN).cancel(16); filter().type(Entity1_16Types.HOGLIN).cancel(15); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/packets/EntityPackets1_16_2.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/packets/EntityPackets1_16_2.java index a3d57d54..f3e2fb83 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/packets/EntityPackets1_16_2.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/packets/EntityPackets1_16_2.java @@ -107,7 +107,7 @@ public class EntityPackets1_16_2 extends EntityRewriter Types1_16.META_TYPES.particleType, Types1_16.META_TYPES.optionalComponentType); mapTypes(Entity1_16_2Types.values(), Entity1_16Types.class); - mapEntityTypeWithData(Entity1_16_2Types.PIGLIN_BRUTE, Entity1_16_2Types.PIGLIN).jsonName("Piglin Brute"); + mapEntityTypeWithData(Entity1_16_2Types.PIGLIN_BRUTE, Entity1_16_2Types.PIGLIN).jsonName(); filter().filterFamily(Entity1_16_2Types.ABSTRACT_PIGLIN).index(15).toIndex(16); filter().filterFamily(Entity1_16_2Types.ABSTRACT_PIGLIN).index(16).toIndex(15); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/EntityPackets1_17.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/EntityPackets1_17.java index 60aaf251..2219f6cb 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/EntityPackets1_17.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/EntityPackets1_17.java @@ -193,10 +193,10 @@ public final class EntityPackets1_17 extends EntityRewriter @Override protected void registerRewrites() { - mapEntityTypeWithData(Entity1_10Types.EntityType.POLAR_BEAR, Entity1_10Types.EntityType.SHEEP).mobName("Polar Bear"); + mapEntityTypeWithData(Entity1_10Types.EntityType.POLAR_BEAR, Entity1_10Types.EntityType.SHEEP).plainName(); // Change the sheep color when the polar bear is standing up (index 13 -> Standing up) filter().type(Entity1_10Types.EntityType.POLAR_BEAR).index(13).handler((event, meta) -> { diff --git a/common/src/main/resources/assets/viabackwards/data/mapping-1.10to1.11.json b/common/src/main/resources/assets/viabackwards/data/mapping-1.10to1.11.json index c2782028..b3d17b82 100644 --- a/common/src/main/resources/assets/viabackwards/data/mapping-1.10to1.11.json +++ b/common/src/main/resources/assets/viabackwards/data/mapping-1.10to1.11.json @@ -31,5 +31,14 @@ "item.armor.equip_elytra": "item.armor.equip_generic", "item.bottle.empty": "item.bottle.fill", "item.totem.use": "block.anvil.destroy" + }, + "entitynames": { + "wither_skeleton": "Polar Bear", + "stray": "Stray", + "husk": "Husk", + "evocation_illager": "Evoker", + "vex": "Vex", + "vindication_illager": "Vindicator", + "liama": "Llama" } } \ No newline at end of file diff --git a/common/src/main/resources/assets/viabackwards/data/mapping-1.11to1.12.json b/common/src/main/resources/assets/viabackwards/data/mapping-1.11to1.12.json index feeeeabe..dbf17657 100644 --- a/common/src/main/resources/assets/viabackwards/data/mapping-1.11to1.12.json +++ b/common/src/main/resources/assets/viabackwards/data/mapping-1.11to1.12.json @@ -48,5 +48,9 @@ "entity.parrot.step": "entity.chicken.step", "entity.player.hurt_drown": "entity.player.hurt", "entity.player.hurt_on_fire": "entity.player.hurt" + }, + "entitynames": { + "parrot": "Parrot", + "illusion_illager": "Illusioner" } } \ No newline at end of file diff --git a/common/src/main/resources/assets/viabackwards/data/mapping-1.12to1.13.json b/common/src/main/resources/assets/viabackwards/data/mapping-1.12to1.13.json index a0bd5b10..a678148a 100644 --- a/common/src/main/resources/assets/viabackwards/data/mapping-1.12to1.13.json +++ b/common/src/main/resources/assets/viabackwards/data/mapping-1.12to1.13.json @@ -5960,5 +5960,15 @@ "item.trident.throw": "entity.skeleton.shoot", "item.trident.thunder": "entity.lightning_bolt.thunder", "music.under_water": "music.creative" + }, + "entitynames": { + "drowned": "Drowned", + "cod": "Cod", + "salmon": "Salmon", + "pufferfish": "Pufferfish", + "tropical_fish": "Tropical Fish", + "phantom": "Phantom", + "dolphin": "Dolphin", + "turtle": "Turtle" } } \ No newline at end of file diff --git a/common/src/main/resources/assets/viabackwards/data/mapping-1.13.2to1.14.json b/common/src/main/resources/assets/viabackwards/data/mapping-1.13.2to1.14.json index 7b4c12f4..912774ed 100644 --- a/common/src/main/resources/assets/viabackwards/data/mapping-1.13.2to1.14.json +++ b/common/src/main/resources/assets/viabackwards/data/mapping-1.13.2to1.14.json @@ -352,7 +352,7 @@ "minecraft:brick_wall": "minecraft:cobblestone_wall[", "minecraft:prismarine_wall": "minecraft:cobblestone_wall[", "minecraft:sandstone_wall": "minecraft:cobblestone_wall[", - "minecraft:red_sandstone_wall": "minecraft:cobblestone_wall[", + "minecraft:red_sandstone_wall": "minecraft:cobblestone_wall[", "minecraft:mossy_stone_brick_wall": "minecraft:mossy_cobblestone_wall[", "minecraft:granite_wall": "minecraft:cobblestone_wall[", "minecraft:stone_brick_wall": "minecraft:cobblestone_wall[", @@ -1008,5 +1008,14 @@ "sneeze": "spit", "campfire_cosy_smoke": "cloud", "campfire_signal_smoke": "cloud" + }, + "entitynames": { + "cat": "Cat", + "trader_llama": "Trader Llama", + "fox": "Fox", + "panda": "Panda", + "pillager": "Pillager", + "wandering_trader": "Wandering Trader", + "ravager": "Ravager" } } \ No newline at end of file diff --git a/common/src/main/resources/assets/viabackwards/data/mapping-1.14to1.15.json b/common/src/main/resources/assets/viabackwards/data/mapping-1.14to1.15.json index 7352644d..e3187ba3 100644 --- a/common/src/main/resources/assets/viabackwards/data/mapping-1.14to1.15.json +++ b/common/src/main/resources/assets/viabackwards/data/mapping-1.14to1.15.json @@ -94,5 +94,8 @@ "falling_honey": "falling_lava", "landing_honey": "landing_lava", "falling_nectar": "falling_water" + }, + "entitynames": { + "bee": "Bee" } } \ No newline at end of file diff --git a/common/src/main/resources/assets/viabackwards/data/mapping-1.15to1.16.json b/common/src/main/resources/assets/viabackwards/data/mapping-1.15to1.16.json index 182e83d4..1f091eb5 100644 --- a/common/src/main/resources/assets/viabackwards/data/mapping-1.15to1.16.json +++ b/common/src/main/resources/assets/viabackwards/data/mapping-1.15to1.16.json @@ -6242,5 +6242,11 @@ "landing_obsidian_tear": "landing_lava", "reverse_portal": "portal", "white_ash": "mycelium" + }, + "entitynames": { + "hoglin": "Hoglin", + "zoglin": "Zoglin", + "piglin": "Piglin", + "strider": "Strider" } } \ No newline at end of file diff --git a/common/src/main/resources/assets/viabackwards/data/mapping-1.16.2to1.17.json b/common/src/main/resources/assets/viabackwards/data/mapping-1.16.2to1.17.json index fec5754d..5648005c 100644 --- a/common/src/main/resources/assets/viabackwards/data/mapping-1.16.2to1.17.json +++ b/common/src/main/resources/assets/viabackwards/data/mapping-1.16.2to1.17.json @@ -1177,7 +1177,6 @@ "id": "minecraft:silverfish_spawn_egg", "name": "1.17 Goat Spawn Egg" }, - "minecraft:raw_iron_block": { "id": "minecraft:iron_block", "name": "1.17 Raw Iron Block" @@ -1411,5 +1410,10 @@ "electric_spark": "happy_villager", "scrape": "happy_villager", "light": "barrier" + }, + "entitynames": { + "axolotl": "Axolotl", + "goat": "Goat", + "glow_squid": "Glow Squid" } } \ No newline at end of file diff --git a/common/src/main/resources/assets/viabackwards/data/mapping-1.16to1.16.2.json b/common/src/main/resources/assets/viabackwards/data/mapping-1.16to1.16.2.json index 42a8d6a2..ecdc6338 100644 --- a/common/src/main/resources/assets/viabackwards/data/mapping-1.16to1.16.2.json +++ b/common/src/main/resources/assets/viabackwards/data/mapping-1.16to1.16.2.json @@ -29,5 +29,8 @@ "entity.piglin_brute.hurt": "entity.piglin.hurt", "entity.piglin_brute.step": "entity.piglin.step", "entity.piglin_brute.converted_to_zombified": "entity.piglin.converted_to_zombified" + }, + "entitynames": { + "piglin_brute": "Piglin Brute" } } \ No newline at end of file diff --git a/common/src/main/resources/assets/viabackwards/data/mapping-1.9.4to1.10.json b/common/src/main/resources/assets/viabackwards/data/mapping-1.9.4to1.10.json index d4483904..983c13c3 100644 --- a/common/src/main/resources/assets/viabackwards/data/mapping-1.9.4to1.10.json +++ b/common/src/main/resources/assets/viabackwards/data/mapping-1.9.4to1.10.json @@ -19,5 +19,8 @@ "entity.wither_skeleton.death": "entity.skeleton.death", "entity.wither_skeleton.hurt": "entity.skeleton.hurt", "entity.wither_skeleton.step": "entity.skeleton.step" + }, + "entitynames": { + "polar_bear": "Polar Bear" } } \ No newline at end of file