Make mapped entity names configurable

This commit is contained in:
Nassim Jahnke 2021-11-13 11:06:59 +01:00
parent 95bc340b06
commit becba6498e
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
25 changed files with 171 additions and 57 deletions

View File

@ -36,6 +36,7 @@ public class BackwardsMappings extends MappingDataBase {
private final Class<? extends Protocol> vvProtocolClass; private final Class<? extends Protocol> vvProtocolClass;
private Int2ObjectMap<MappedItem> backwardsItemMappings; private Int2ObjectMap<MappedItem> backwardsItemMappings;
private Map<String, String> backwardsSoundMappings; private Map<String, String> backwardsSoundMappings;
private Map<String, String> entityNames;
public BackwardsMappings(String oldVersion, String newVersion, @Nullable Class<? extends Protocol> vvProtocolClass) { public BackwardsMappings(String oldVersion, String newVersion, @Nullable Class<? extends Protocol> vvProtocolClass) {
this(oldVersion, newVersion, vvProtocolClass, false); this(oldVersion, newVersion, vvProtocolClass, false);
@ -60,7 +61,12 @@ public class BackwardsMappings extends MappingDataBase {
JsonObject diffSounds = diffMappings.getAsJsonObject("sounds"); JsonObject diffSounds = diffMappings.getAsJsonObject("sounds");
if (diffSounds != null) { 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); return backwardsSoundMappings.get(id);
} }
public @Nullable String mappedEntityName(String entityName) {
return entityNames.get(entityName);
}
public @Nullable Int2ObjectMap<MappedItem> getBackwardsItemMappings() { public @Nullable Int2ObjectMap<MappedItem> getBackwardsItemMappings() {
return backwardsItemMappings; return backwardsItemMappings;
} }

View File

@ -73,7 +73,7 @@ public class VBMappingDataLoader {
} }
public static void mapIdentifiers(int[] output, JsonObject oldIdentifiers, JsonObject newIdentifiers, JsonObject diffIdentifiers, boolean warnOnMissing) { public static void mapIdentifiers(int[] output, JsonObject oldIdentifiers, JsonObject newIdentifiers, JsonObject diffIdentifiers, boolean warnOnMissing) {
Object2IntMap newIdentifierMap = MappingDataLoader.indexedObjectToMap(newIdentifiers); Object2IntMap<String> newIdentifierMap = MappingDataLoader.indexedObjectToMap(newIdentifiers);
for (Map.Entry<String, JsonElement> entry : oldIdentifiers.entrySet()) { for (Map.Entry<String, JsonElement> entry : oldIdentifiers.entrySet()) {
String key = entry.getValue().getAsString(); String key = entry.getValue().getAsString();
int mappedId = newIdentifierMap.getInt(key); int mappedId = newIdentifierMap.getInt(key);
@ -113,8 +113,8 @@ public class VBMappingDataLoader {
} }
} }
public static Map<String, String> objectToMap(JsonObject object) { public static Map<String, String> objectToNamespacedMap(JsonObject object) {
Map<String, String> mappings = new HashMap<>(); Map<String, String> mappings = new HashMap<>(object.size());
for (Map.Entry<String, JsonElement> entry : object.entrySet()) { for (Map.Entry<String, JsonElement> entry : object.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
if (key.indexOf(':') == -1) { if (key.indexOf(':') == -1) {
@ -129,6 +129,14 @@ public class VBMappingDataLoader {
return mappings; return mappings;
} }
public static Map<String, String> objectToMap(JsonObject object) {
Map<String, String> mappings = new HashMap<>(object.size());
for (Map.Entry<String, JsonElement> entry : object.entrySet()) {
mappings.put(entry.getKey(), entry.getValue().getAsString());
}
return mappings;
}
public static Int2ObjectMap<MappedItem> loadItemMappings(JsonObject oldMapping, JsonObject newMapping, JsonObject diffMapping) { public static Int2ObjectMap<MappedItem> loadItemMappings(JsonObject oldMapping, JsonObject newMapping, JsonObject diffMapping) {
return loadItemMappings(oldMapping, newMapping, diffMapping, false); return loadItemMappings(oldMapping, newMapping, diffMapping, false);
} }

View File

@ -18,27 +18,40 @@
package com.viaversion.viabackwards.api.entities.storage; 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 com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ChatRewriter;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Locale;
public class EntityData { public class EntityData {
private final BackwardsProtocol<?, ?, ?, ?> protocol;
private final int id; private final int id;
private final int replacementId; private final int replacementId;
private Object mobName; private final String key;
private NameVisibility nameVisibility = NameVisibility.NONE;
private MetaCreator defaultMeta; private MetaCreator defaultMeta;
public EntityData(int id, int replacementId) { public EntityData(BackwardsProtocol<?, ?, ?, ?> protocol, EntityType type, int replacementId) {
this.id = id; this(protocol, type.name(), type.getId(), replacementId);
this.replacementId = replacementId;
} }
public EntityData jsonName(String name) { public EntityData(BackwardsProtocol<?, ?, ?, ?> protocol, String key, int id, int replacementId) {
this.mobName = ChatRewriter.legacyTextToJson(name); this.protocol = protocol;
this.id = id;
this.replacementId = replacementId;
this.key = key.toLowerCase(Locale.ROOT);
}
public EntityData jsonName() {
this.nameVisibility = NameVisibility.JSON;
return this; return this;
} }
public EntityData mobName(String name) { public EntityData plainName() {
this.mobName = name; this.nameVisibility = NameVisibility.PLAIN;
return this; return this;
} }
@ -59,7 +72,16 @@ public class EntityData {
* @return custom mobname, can be either a String or a JsonElement * @return custom mobname, can be either a String or a JsonElement
*/ */
public @Nullable Object mobName() { 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() { public int replacementId() {
@ -82,7 +104,7 @@ public class EntityData {
public String toString() { public String toString() {
return "EntityData{" + return "EntityData{" +
"id=" + id + "id=" + id +
", mobName='" + mobName + '\'' + ", mobName='" + key + '\'' +
", replacementId=" + replacementId + ", replacementId=" + replacementId +
", defaultMeta=" + defaultMeta + ", defaultMeta=" + defaultMeta +
'}'; '}';
@ -93,4 +115,10 @@ public class EntityData {
void createMeta(WrappedMetadata storage); void createMeta(WrappedMetadata storage);
} }
private enum NameVisibility {
PLAIN,
JSON,
NONE
}
} }

View File

@ -17,19 +17,19 @@
*/ */
package com.viaversion.viabackwards.api.entities.storage; package com.viaversion.viabackwards.api.entities.storage;
import com.viaversion.viabackwards.api.BackwardsProtocol;
public class EntityObjectData extends EntityData { public class EntityObjectData extends EntityData {
private final boolean isObject;
private final int objectData; private final int objectData;
public EntityObjectData(int id, boolean isObject, int replacementId, int objectData) { public EntityObjectData(BackwardsProtocol<?, ?, ?, ?> protocol, String key, int id, int replacementId, int objectData) {
super(id, replacementId); super(protocol, key, id, replacementId);
this.isObject = isObject;
this.objectData = objectData; this.objectData = objectData;
} }
@Override @Override
public boolean isObjectType() { public boolean isObjectType() {
return isObject; return true;
} }
@Override @Override

View File

@ -131,7 +131,7 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends En
// Already rewrite the id here // Already rewrite the id here
int mappedReplacementId = newEntityId(mappedType.getId()); int mappedReplacementId = newEntityId(mappedType.getId());
EntityData data = new EntityData(type.getId(), mappedReplacementId); EntityData data = new EntityData(protocol, type, mappedReplacementId);
mapEntityType(type.getId(), mappedReplacementId); mapEntityType(type.getId(), mappedReplacementId);
entityDataMappings.put(type.getId(), data); entityDataMappings.put(type.getId(), data);
return data; return data;

View File

@ -52,7 +52,7 @@ public abstract class LegacyEntityRewriter<T extends BackwardsProtocol> extends
} }
protected EntityObjectData mapObjectType(ObjectType oldObjectType, ObjectType replacement, int data) { 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); objectTypes.put(oldObjectType, entData);
return entData; return entData;
} }

View File

@ -215,10 +215,10 @@ public class EntityPackets1_11 extends LegacyEntityRewriter<Protocol1_10To1_11>
// Guardian // Guardian
mapEntityTypeWithData(Entity1_11Types.EntityType.ELDER_GUARDIAN, Entity1_11Types.EntityType.GUARDIAN); mapEntityTypeWithData(Entity1_11Types.EntityType.ELDER_GUARDIAN, Entity1_11Types.EntityType.GUARDIAN);
// Skeletons // Skeletons
mapEntityTypeWithData(Entity1_11Types.EntityType.WITHER_SKELETON, Entity1_11Types.EntityType.SKELETON).mobName("Wither Skeleton").spawnMetadata(storage -> storage.add(getSkeletonTypeMeta(1))); 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).mobName("Stray").spawnMetadata(storage -> storage.add(getSkeletonTypeMeta(2))); mapEntityTypeWithData(Entity1_11Types.EntityType.STRAY, Entity1_11Types.EntityType.SKELETON).plainName().spawnMetadata(storage -> storage.add(getSkeletonTypeMeta(2)));
// Zombies // 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)); mapEntityTypeWithData(Entity1_11Types.EntityType.ZOMBIE_VILLAGER, Entity1_11Types.EntityType.ZOMBIE).spawnMetadata(storage -> handleZombieType(storage, 1));
// Horses // 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. 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<Protocol1_10To1_11>
mapEntityTypeWithData(Entity1_11Types.EntityType.ZOMBIE_HORSE, Entity1_11Types.EntityType.HORSE).spawnMetadata(storage -> storage.add(getHorseMetaType(3))); mapEntityTypeWithData(Entity1_11Types.EntityType.ZOMBIE_HORSE, Entity1_11Types.EntityType.HORSE).spawnMetadata(storage -> storage.add(getHorseMetaType(3)));
// New mobs // New mobs
mapEntityTypeWithData(Entity1_11Types.EntityType.EVOCATION_FANGS, Entity1_11Types.EntityType.SHULKER); 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.EVOCATION_ILLAGER, Entity1_11Types.EntityType.VILLAGER).plainName();
mapEntityTypeWithData(Entity1_11Types.EntityType.VEX, Entity1_11Types.EntityType.BAT).mobName("Vex"); mapEntityTypeWithData(Entity1_11Types.EntityType.VEX, Entity1_11Types.EntityType.BAT).plainName();
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.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).mobName("Llama").spawnMetadata(storage -> storage.add(getHorseMetaType(1))); 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); mapEntityTypeWithData(Entity1_11Types.EntityType.LIAMA_SPIT, Entity1_11Types.EntityType.SNOWBALL);
mapObjectType(Entity1_11Types.ObjectType.LIAMA_SPIT, Entity1_11Types.ObjectType.SNOWBALL, -1); mapObjectType(Entity1_11Types.ObjectType.LIAMA_SPIT, Entity1_11Types.ObjectType.SNOWBALL, -1);

View File

@ -19,6 +19,7 @@
package com.viaversion.viabackwards.protocol.protocol1_11_1to1_12; package com.viaversion.viabackwards.protocol.protocol1_11_1to1_12;
import com.viaversion.viabackwards.api.BackwardsProtocol; 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.data.ShoulderTracker;
import com.viaversion.viabackwards.protocol.protocol1_11_1to1_12.packets.BlockItemPackets1_12; import com.viaversion.viabackwards.protocol.protocol1_11_1to1_12.packets.BlockItemPackets1_12;
import com.viaversion.viabackwards.protocol.protocol1_11_1to1_12.packets.ChatPackets1_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<ClientboundPackets1_12, ClientboundPackets1_9_3, ServerboundPackets1_12, ServerboundPackets1_9_3> { public class Protocol1_11_1To1_12 extends BackwardsProtocol<ClientboundPackets1_12, ClientboundPackets1_9_3, ServerboundPackets1_12, ServerboundPackets1_9_3> {
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 EntityPackets1_12 entityPackets = new EntityPackets1_12(this);
private final BlockItemPackets1_12 blockItemPackets = new BlockItemPackets1_12(this); private final BlockItemPackets1_12 blockItemPackets = new BlockItemPackets1_12(this);
@ -83,6 +90,11 @@ public class Protocol1_11_1To1_12 extends BackwardsProtocol<ClientboundPackets1_
user.put(new ShoulderTracker(user)); user.put(new ShoulderTracker(user));
} }
@Override
public BackwardsMappings getMappingData() {
return MAPPINGS;
}
@Override @Override
public EntityPackets1_12 getEntityRewriter() { public EntityPackets1_12 getEntityRewriter() {
return entityPackets; return entityPackets;
@ -92,4 +104,9 @@ public class Protocol1_11_1To1_12 extends BackwardsProtocol<ClientboundPackets1_
public BlockItemPackets1_12 getItemRewriter() { public BlockItemPackets1_12 getItemRewriter() {
return blockItemPackets; return blockItemPackets;
} }
@Override
public boolean hasMappingDataToLoad() {
return true;
}
} }

View File

@ -212,8 +212,8 @@ public class EntityPackets1_12 extends LegacyEntityRewriter<Protocol1_11_1To1_12
@Override @Override
protected void registerRewrites() { protected void registerRewrites() {
mapEntityTypeWithData(Entity1_12Types.EntityType.PARROT, Entity1_12Types.EntityType.BAT).mobName("Parrot").spawnMetadata(storage -> storage.add(new Metadata(12, MetaType1_12.Byte, (byte) 0x00))); 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).mobName("Illusioner"); mapEntityTypeWithData(Entity1_12Types.EntityType.ILLUSION_ILLAGER, Entity1_12Types.EntityType.EVOCATION_ILLAGER).plainName();
// Handle Illager // Handle Illager
filter().filterFamily(Entity1_12Types.EntityType.EVOCATION_ILLAGER).cancel(12); filter().filterFamily(Entity1_12Types.EntityType.EVOCATION_ILLAGER).cancel(12);

View File

@ -281,25 +281,25 @@ public class EntityPackets1_13 extends LegacyEntityRewriter<Protocol1_12_2To1_13
@Override @Override
protected void registerRewrites() { protected void registerRewrites() {
// Rewrite new Entity 'drowned' // Rewrite new Entity 'drowned'
mapEntityTypeWithData(Entity1_13Types.EntityType.DROWNED, Entity1_13Types.EntityType.ZOMBIE_VILLAGER).mobName("Drowned"); mapEntityTypeWithData(Entity1_13Types.EntityType.DROWNED, Entity1_13Types.EntityType.ZOMBIE_VILLAGER).plainName();
// Fishy // Fishy
mapEntityTypeWithData(Entity1_13Types.EntityType.COD, Entity1_13Types.EntityType.SQUID).mobName("Cod"); mapEntityTypeWithData(Entity1_13Types.EntityType.COD, Entity1_13Types.EntityType.SQUID).plainName();
mapEntityTypeWithData(Entity1_13Types.EntityType.SALMON, Entity1_13Types.EntityType.SQUID).mobName("Salmon"); mapEntityTypeWithData(Entity1_13Types.EntityType.SALMON, Entity1_13Types.EntityType.SQUID).plainName();
mapEntityTypeWithData(Entity1_13Types.EntityType.PUFFERFISH, Entity1_13Types.EntityType.SQUID).mobName("Puffer Fish"); mapEntityTypeWithData(Entity1_13Types.EntityType.PUFFERFISH, Entity1_13Types.EntityType.SQUID).plainName();
mapEntityTypeWithData(Entity1_13Types.EntityType.TROPICAL_FISH, Entity1_13Types.EntityType.SQUID).mobName("Tropical Fish"); mapEntityTypeWithData(Entity1_13Types.EntityType.TROPICAL_FISH, Entity1_13Types.EntityType.SQUID).plainName();
// Phantom // Phantom
mapEntityTypeWithData(Entity1_13Types.EntityType.PHANTOM, Entity1_13Types.EntityType.PARROT).mobName("Phantom").spawnMetadata(storage -> { mapEntityTypeWithData(Entity1_13Types.EntityType.PHANTOM, Entity1_13Types.EntityType.PARROT).plainName().spawnMetadata(storage -> {
// The phantom is grey/blue so let's do yellow/blue // The phantom is grey/blue so let's do yellow/blue
storage.add(new Metadata(15, MetaType1_12.VarInt, 3)); storage.add(new Metadata(15, MetaType1_12.VarInt, 3));
}); });
// Dolphin // Dolphin
mapEntityTypeWithData(Entity1_13Types.EntityType.DOLPHIN, Entity1_13Types.EntityType.SQUID).mobName("Dolphin"); mapEntityTypeWithData(Entity1_13Types.EntityType.DOLPHIN, Entity1_13Types.EntityType.SQUID).plainName();
// Turtle // 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 // Rewrite Meta types
filter().handler((event, meta) -> { filter().handler((event, meta) -> {

View File

@ -352,13 +352,13 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
protected void registerRewrites() { protected void registerRewrites() {
mapTypes(Entity1_14Types.values(), Entity1_13Types.EntityType.class); mapTypes(Entity1_14Types.values(), Entity1_13Types.EntityType.class);
mapEntityTypeWithData(Entity1_14Types.CAT, Entity1_14Types.OCELOT).jsonName("Cat"); mapEntityTypeWithData(Entity1_14Types.CAT, Entity1_14Types.OCELOT).jsonName();
mapEntityTypeWithData(Entity1_14Types.TRADER_LLAMA, Entity1_14Types.LLAMA).jsonName("Trader Llama"); mapEntityTypeWithData(Entity1_14Types.TRADER_LLAMA, Entity1_14Types.LLAMA).jsonName();
mapEntityTypeWithData(Entity1_14Types.FOX, Entity1_14Types.WOLF).jsonName("Fox"); mapEntityTypeWithData(Entity1_14Types.FOX, Entity1_14Types.WOLF).jsonName();
mapEntityTypeWithData(Entity1_14Types.PANDA, Entity1_14Types.POLAR_BEAR).jsonName("Panda"); mapEntityTypeWithData(Entity1_14Types.PANDA, Entity1_14Types.POLAR_BEAR).jsonName();
mapEntityTypeWithData(Entity1_14Types.PILLAGER, Entity1_14Types.VILLAGER).jsonName("Pillager"); mapEntityTypeWithData(Entity1_14Types.PILLAGER, Entity1_14Types.VILLAGER).jsonName();
mapEntityTypeWithData(Entity1_14Types.WANDERING_TRADER, Entity1_14Types.VILLAGER).jsonName("Wandering Trader"); mapEntityTypeWithData(Entity1_14Types.WANDERING_TRADER, Entity1_14Types.VILLAGER).jsonName();
mapEntityTypeWithData(Entity1_14Types.RAVAGER, Entity1_14Types.COW).jsonName("Ravager"); mapEntityTypeWithData(Entity1_14Types.RAVAGER, Entity1_14Types.COW).jsonName();
filter().handler((event, meta) -> { filter().handler((event, meta) -> {
int typeId = meta.metaType().typeId(); int typeId = meta.metaType().typeId();

View File

@ -205,7 +205,7 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
filter().type(Entity1_15Types.BEE).cancel(15); filter().type(Entity1_15Types.BEE).cancel(15);
filter().type(Entity1_15Types.BEE).cancel(16); 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(14, Types1_14.META_TYPES.booleanType, false));
storage.add(new Metadata(15, Types1_14.META_TYPES.varIntType, 2)); storage.add(new Metadata(15, Types1_14.META_TYPES.varIntType, 2));
}); });

View File

@ -270,10 +270,10 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
mapEntityType(Entity1_16Types.ZOMBIFIED_PIGLIN, Entity1_15Types.ZOMBIE_PIGMAN); mapEntityType(Entity1_16Types.ZOMBIFIED_PIGLIN, Entity1_15Types.ZOMBIE_PIGMAN);
mapTypes(Entity1_16Types.values(), Entity1_15Types.class); mapTypes(Entity1_16Types.values(), Entity1_15Types.class);
mapEntityTypeWithData(Entity1_16Types.HOGLIN, Entity1_16Types.COW).jsonName("Hoglin"); mapEntityTypeWithData(Entity1_16Types.HOGLIN, Entity1_16Types.COW).jsonName();
mapEntityTypeWithData(Entity1_16Types.ZOGLIN, Entity1_16Types.COW).jsonName("Zoglin"); mapEntityTypeWithData(Entity1_16Types.ZOGLIN, Entity1_16Types.COW).jsonName();
mapEntityTypeWithData(Entity1_16Types.PIGLIN, Entity1_16Types.ZOMBIFIED_PIGLIN).jsonName("Piglin"); mapEntityTypeWithData(Entity1_16Types.PIGLIN, Entity1_16Types.ZOMBIFIED_PIGLIN).jsonName();
mapEntityTypeWithData(Entity1_16Types.STRIDER, Entity1_16Types.MAGMA_CUBE).jsonName("Strider"); mapEntityTypeWithData(Entity1_16Types.STRIDER, Entity1_16Types.MAGMA_CUBE).jsonName();
filter().type(Entity1_16Types.ZOGLIN).cancel(16); filter().type(Entity1_16Types.ZOGLIN).cancel(16);
filter().type(Entity1_16Types.HOGLIN).cancel(15); filter().type(Entity1_16Types.HOGLIN).cancel(15);

View File

@ -107,7 +107,7 @@ public class EntityPackets1_16_2 extends EntityRewriter<Protocol1_16_1To1_16_2>
Types1_16.META_TYPES.particleType, Types1_16.META_TYPES.optionalComponentType); Types1_16.META_TYPES.particleType, Types1_16.META_TYPES.optionalComponentType);
mapTypes(Entity1_16_2Types.values(), Entity1_16Types.class); 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(15).toIndex(16);
filter().filterFamily(Entity1_16_2Types.ABSTRACT_PIGLIN).index(16).toIndex(15); filter().filterFamily(Entity1_16_2Types.ABSTRACT_PIGLIN).index(16).toIndex(15);

View File

@ -193,10 +193,10 @@ public final class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17
filter().type(Entity1_17Types.GOAT).cancel(17); filter().type(Entity1_17Types.GOAT).cancel(17);
mapEntityTypeWithData(Entity1_17Types.AXOLOTL, Entity1_17Types.TROPICAL_FISH).jsonName("Axolotl"); mapEntityTypeWithData(Entity1_17Types.AXOLOTL, Entity1_17Types.TROPICAL_FISH).jsonName();
mapEntityTypeWithData(Entity1_17Types.GOAT, Entity1_17Types.SHEEP).jsonName("Goat"); mapEntityTypeWithData(Entity1_17Types.GOAT, Entity1_17Types.SHEEP).jsonName();
mapEntityTypeWithData(Entity1_17Types.GLOW_SQUID, Entity1_17Types.SQUID).jsonName("Glow Squid"); mapEntityTypeWithData(Entity1_17Types.GLOW_SQUID, Entity1_17Types.SQUID).jsonName();
mapEntityTypeWithData(Entity1_17Types.GLOW_ITEM_FRAME, Entity1_17Types.ITEM_FRAME); mapEntityTypeWithData(Entity1_17Types.GLOW_ITEM_FRAME, Entity1_17Types.ITEM_FRAME);
filter().type(Entity1_17Types.SHULKER).addIndex(17); // TODO Handle attachment pos? filter().type(Entity1_17Types.SHULKER).addIndex(17); // TODO Handle attachment pos?

View File

@ -157,7 +157,7 @@ public class EntityPackets1_10 extends LegacyEntityRewriter<Protocol1_9_4To1_10>
@Override @Override
protected void registerRewrites() { 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) // 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) -> { filter().type(Entity1_10Types.EntityType.POLAR_BEAR).index(13).handler((event, meta) -> {

View File

@ -31,5 +31,14 @@
"item.armor.equip_elytra": "item.armor.equip_generic", "item.armor.equip_elytra": "item.armor.equip_generic",
"item.bottle.empty": "item.bottle.fill", "item.bottle.empty": "item.bottle.fill",
"item.totem.use": "block.anvil.destroy" "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"
} }
} }

View File

@ -48,5 +48,9 @@
"entity.parrot.step": "entity.chicken.step", "entity.parrot.step": "entity.chicken.step",
"entity.player.hurt_drown": "entity.player.hurt", "entity.player.hurt_drown": "entity.player.hurt",
"entity.player.hurt_on_fire": "entity.player.hurt" "entity.player.hurt_on_fire": "entity.player.hurt"
},
"entitynames": {
"parrot": "Parrot",
"illusion_illager": "Illusioner"
} }
} }

View File

@ -5960,5 +5960,15 @@
"item.trident.throw": "entity.skeleton.shoot", "item.trident.throw": "entity.skeleton.shoot",
"item.trident.thunder": "entity.lightning_bolt.thunder", "item.trident.thunder": "entity.lightning_bolt.thunder",
"music.under_water": "music.creative" "music.under_water": "music.creative"
},
"entitynames": {
"drowned": "Drowned",
"cod": "Cod",
"salmon": "Salmon",
"pufferfish": "Pufferfish",
"tropical_fish": "Tropical Fish",
"phantom": "Phantom",
"dolphin": "Dolphin",
"turtle": "Turtle"
} }
} }

View File

@ -1008,5 +1008,14 @@
"sneeze": "spit", "sneeze": "spit",
"campfire_cosy_smoke": "cloud", "campfire_cosy_smoke": "cloud",
"campfire_signal_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"
} }
} }

View File

@ -94,5 +94,8 @@
"falling_honey": "falling_lava", "falling_honey": "falling_lava",
"landing_honey": "landing_lava", "landing_honey": "landing_lava",
"falling_nectar": "falling_water" "falling_nectar": "falling_water"
},
"entitynames": {
"bee": "Bee"
} }
} }

View File

@ -6242,5 +6242,11 @@
"landing_obsidian_tear": "landing_lava", "landing_obsidian_tear": "landing_lava",
"reverse_portal": "portal", "reverse_portal": "portal",
"white_ash": "mycelium" "white_ash": "mycelium"
},
"entitynames": {
"hoglin": "Hoglin",
"zoglin": "Zoglin",
"piglin": "Piglin",
"strider": "Strider"
} }
} }

View File

@ -1177,7 +1177,6 @@
"id": "minecraft:silverfish_spawn_egg", "id": "minecraft:silverfish_spawn_egg",
"name": "1.17 Goat Spawn Egg" "name": "1.17 Goat Spawn Egg"
}, },
"minecraft:raw_iron_block": { "minecraft:raw_iron_block": {
"id": "minecraft:iron_block", "id": "minecraft:iron_block",
"name": "1.17 Raw Iron Block" "name": "1.17 Raw Iron Block"
@ -1411,5 +1410,10 @@
"electric_spark": "happy_villager", "electric_spark": "happy_villager",
"scrape": "happy_villager", "scrape": "happy_villager",
"light": "barrier" "light": "barrier"
},
"entitynames": {
"axolotl": "Axolotl",
"goat": "Goat",
"glow_squid": "Glow Squid"
} }
} }

View File

@ -29,5 +29,8 @@
"entity.piglin_brute.hurt": "entity.piglin.hurt", "entity.piglin_brute.hurt": "entity.piglin.hurt",
"entity.piglin_brute.step": "entity.piglin.step", "entity.piglin_brute.step": "entity.piglin.step",
"entity.piglin_brute.converted_to_zombified": "entity.piglin.converted_to_zombified" "entity.piglin_brute.converted_to_zombified": "entity.piglin.converted_to_zombified"
},
"entitynames": {
"piglin_brute": "Piglin Brute"
} }
} }

View File

@ -19,5 +19,8 @@
"entity.wither_skeleton.death": "entity.skeleton.death", "entity.wither_skeleton.death": "entity.skeleton.death",
"entity.wither_skeleton.hurt": "entity.skeleton.hurt", "entity.wither_skeleton.hurt": "entity.skeleton.hurt",
"entity.wither_skeleton.step": "entity.skeleton.step" "entity.wither_skeleton.step": "entity.skeleton.step"
},
"entitynames": {
"polar_bear": "Polar Bear"
} }
} }