SPIGOT-5336: Field name parity with Minecraft keys

By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
Bukkit/Spigot
2024-04-24 01:15:00 +10:00
parent 60b9f5bacc
commit d9a704e3f6
7 changed files with 96 additions and 199 deletions

View File

@@ -33,7 +33,7 @@ public enum EntityType implements Keyed, Translatable {
* Spawn with {@link World#dropItem(Location, ItemStack)} or {@link
* World#dropItemNaturally(Location, ItemStack)}
*/
DROPPED_ITEM("item", Item.class, 1, false),
ITEM("item", Item.class, 1, false),
/**
* An experience orb.
*/
@@ -61,7 +61,7 @@ public enum EntityType implements Keyed, Translatable {
/**
* A leash attached to a fencepost.
*/
LEASH_HITCH("leash_knot", LeashHitch.class, 8),
LEASH_KNOT("leash_knot", LeashHitch.class, 8),
/**
* A painting on a wall.
*/
@@ -89,15 +89,15 @@ public enum EntityType implements Keyed, Translatable {
/**
* An ender eye signal.
*/
ENDER_SIGNAL("eye_of_ender", EnderSignal.class, 15),
EYE_OF_ENDER("eye_of_ender", EnderSignal.class, 15),
/**
* A flying splash potion.
*/
SPLASH_POTION("potion", ThrownPotion.class, 16, false),
POTION("potion", ThrownPotion.class, 16, false),
/**
* A flying experience bottle.
*/
THROWN_EXP_BOTTLE("experience_bottle", ThrownExpBottle.class, 17),
EXPERIENCE_BOTTLE("experience_bottle", ThrownExpBottle.class, 17),
/**
* An item frame on a wall.
*/
@@ -109,7 +109,7 @@ public enum EntityType implements Keyed, Translatable {
/**
* Primed TNT that is about to explode.
*/
PRIMED_TNT("tnt", TNTPrimed.class, 20),
TNT("tnt", TNTPrimed.class, 20),
/**
* A block that is going to or is about to fall.
*/
@@ -117,7 +117,7 @@ public enum EntityType implements Keyed, Translatable {
/**
* Internal representation of a Firework once it has been launched.
*/
FIREWORK("firework_rocket", Firework.class, 22, false),
FIREWORK_ROCKET("firework_rocket", Firework.class, 22, false),
/**
* @see Husk
*/
@@ -181,7 +181,7 @@ public enum EntityType implements Keyed, Translatable {
/**
* @see CommandMinecart
*/
MINECART_COMMAND("command_block_minecart", CommandMinecart.class, 40),
COMMAND_BLOCK_MINECART("command_block_minecart", CommandMinecart.class, 40),
/**
* A placed boat.
*/
@@ -193,23 +193,23 @@ public enum EntityType implements Keyed, Translatable {
/**
* @see StorageMinecart
*/
MINECART_CHEST("chest_minecart", StorageMinecart.class, 43),
CHEST_MINECART("chest_minecart", StorageMinecart.class, 43),
/**
* @see PoweredMinecart
*/
MINECART_FURNACE("furnace_minecart", PoweredMinecart.class, 44),
FURNACE_MINECART("furnace_minecart", PoweredMinecart.class, 44),
/**
* @see ExplosiveMinecart
*/
MINECART_TNT("tnt_minecart", ExplosiveMinecart.class, 45),
TNT_MINECART("tnt_minecart", ExplosiveMinecart.class, 45),
/**
* @see HopperMinecart
*/
MINECART_HOPPER("hopper_minecart", HopperMinecart.class, 46),
HOPPER_MINECART("hopper_minecart", HopperMinecart.class, 46),
/**
* @see SpawnerMinecart
*/
MINECART_MOB_SPAWNER("spawner_minecart", SpawnerMinecart.class, 47),
SPAWNER_MINECART("spawner_minecart", SpawnerMinecart.class, 47),
CREEPER("creeper", Creeper.class, 50),
SKELETON("skeleton", Skeleton.class, 51),
SPIDER("spider", Spider.class, 52),
@@ -236,8 +236,8 @@ public enum EntityType implements Keyed, Translatable {
CHICKEN("chicken", Chicken.class, 93),
SQUID("squid", Squid.class, 94),
WOLF("wolf", Wolf.class, 95),
MUSHROOM_COW("mooshroom", MushroomCow.class, 96),
SNOWMAN("snow_golem", Snowman.class, 97),
MOOSHROOM("mooshroom", MushroomCow.class, 96),
SNOW_GOLEM("snow_golem", Snowman.class, 97),
OCELOT("ocelot", Ocelot.class, 98),
IRON_GOLEM("iron_golem", IronGolem.class, 99),
HORSE("horse", Horse.class, 100),
@@ -247,7 +247,7 @@ public enum EntityType implements Keyed, Translatable {
LLAMA_SPIT("llama_spit", LlamaSpit.class, 104),
PARROT("parrot", Parrot.class, 105),
VILLAGER("villager", Villager.class, 120),
ENDER_CRYSTAL("end_crystal", EnderCrystal.class, 200),
END_CRYSTAL("end_crystal", EnderCrystal.class, 200),
TURTLE("turtle", Turtle.class, -1),
PHANTOM("phantom", Phantom.class, -1),
TRIDENT("trident", Trident.class, -1),
@@ -305,13 +305,13 @@ public enum EntityType implements Keyed, Translatable {
/**
* A fishing line and bobber.
*/
FISHING_HOOK("fishing_bobber", FishHook.class, -1, false),
FISHING_BOBBER("fishing_bobber", FishHook.class, -1, false),
/**
* A bolt of lightning.
* <p>
* Spawn with {@link World#strikeLightning(Location)}.
*/
LIGHTNING("lightning_bolt", LightningStrike.class, -1, false),
LIGHTNING_BOLT("lightning_bolt", LightningStrike.class, -1, false),
PLAYER("player", Player.class, -1, false),
/**
* An unknown entity without an Entity Class
@@ -336,21 +336,6 @@ public enum EntityType implements Keyed, Translatable {
ID_MAP.put(type.typeId, type);
}
}
// Add legacy names
NAME_MAP.put("xp_orb", EXPERIENCE_ORB);
NAME_MAP.put("eye_of_ender_signal", ENDER_SIGNAL);
NAME_MAP.put("xp_bottle", THROWN_EXP_BOTTLE);
NAME_MAP.put("fireworks_rocket", FIREWORK);
NAME_MAP.put("evocation_fangs", EVOKER_FANGS);
NAME_MAP.put("evocation_illager", EVOKER);
NAME_MAP.put("vindication_illager", VINDICATOR);
NAME_MAP.put("illusion_illager", ILLUSIONER);
NAME_MAP.put("commandblock_minecart", MINECART_COMMAND);
NAME_MAP.put("snowman", SNOWMAN);
NAME_MAP.put("villager_golem", IRON_GOLEM);
NAME_MAP.put("ender_crystal", ENDER_CRYSTAL);
NAME_MAP.put("zombie_pigman", ZOMBIFIED_PIGLIN);
}
private EntityType(/*@Nullable*/ String name, /*@Nullable*/ Class<? extends Entity> clazz, int typeId) {