3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-19 14:30:16 +01:00

Move around types, apply to other enums

This doesn't include ALL abstract types, mostly if they are single-use or not at all relevant to our handling and most likely never will
Dieser Commit ist enthalten in:
Nassim Jahnke 2024-05-04 18:40:44 +02:00
Ursprung 73ed425bf7
Commit d691096ce1
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
42 geänderte Dateien mit 1740 neuen und 1761 gelöschten Zeilen

Datei anzeigen

@ -22,223 +22,232 @@
*/ */
package com.viaversion.viaversion.api.minecraft.entities; package com.viaversion.viaversion.api.minecraft.entities;
import com.google.common.base.Preconditions;
import com.viaversion.viaversion.api.protocol.Protocol;
import com.viaversion.viaversion.util.EntityTypeUtil; import com.viaversion.viaversion.util.EntityTypeUtil;
import java.util.Locale;
import org.checkerframework.checker.nullness.qual.Nullable;
public enum EntityTypes1_14 implements EntityType { public enum EntityTypes1_14 implements EntityType {
ENTITY(-1), ENTITY(null, null),
AREA_EFFECT_CLOUD(0, ENTITY), AREA_EFFECT_CLOUD(ENTITY),
END_CRYSTAL(17, ENTITY), END_CRYSTAL(ENTITY),
EVOKER_FANGS(21, ENTITY), EVOKER_FANGS(ENTITY),
EXPERIENCE_ORB(23, ENTITY), EXPERIENCE_ORB(ENTITY),
EYE_OF_ENDER(24, ENTITY), EYE_OF_ENDER(ENTITY),
FALLING_BLOCK(25, ENTITY), FALLING_BLOCK(ENTITY),
FIREWORK_ROCKET(26, ENTITY), ITEM(ENTITY),
ITEM(34, ENTITY), TNT(ENTITY),
LLAMA_SPIT(39, ENTITY), LIGHTNING_BOLT(ENTITY),
TNT(58, ENTITY),
SHULKER_BULLET(63, ENTITY),
FISHING_BOBBER(101, ENTITY),
LIVINGENTITY(-1, ENTITY), // Hanging entities
ARMOR_STAND(1, LIVINGENTITY), ABSTRACT_HANGING(ENTITY, null),
PLAYER(100, LIVINGENTITY), LEASH_KNOT(ABSTRACT_HANGING),
PAINTING(ABSTRACT_HANGING),
ABSTRACT_INSENTIENT(-1, LIVINGENTITY), ITEM_FRAME(ABSTRACT_HANGING),
ENDER_DRAGON(18, ABSTRACT_INSENTIENT),
ABSTRACT_CREATURE(-1, ABSTRACT_INSENTIENT),
ABSTRACT_AGEABLE(-1, ABSTRACT_CREATURE),
VILLAGER(84, ABSTRACT_AGEABLE),
WANDERING_TRADER(88, ABSTRACT_AGEABLE),
// Animals
ABSTRACT_ANIMAL(-1, ABSTRACT_AGEABLE),
DOLPHIN(13, ABSTRACT_INSENTIENT),
CHICKEN(8, ABSTRACT_ANIMAL),
COW(10, ABSTRACT_ANIMAL),
MOOSHROOM(49, COW),
PANDA(52, ABSTRACT_INSENTIENT),
PIG(54, ABSTRACT_ANIMAL),
POLAR_BEAR(57, ABSTRACT_ANIMAL),
RABBIT(59, ABSTRACT_ANIMAL),
SHEEP(61, ABSTRACT_ANIMAL),
TURTLE(77, ABSTRACT_ANIMAL),
FOX(27, ABSTRACT_ANIMAL),
ABSTRACT_TAMEABLE_ANIMAL(-1, ABSTRACT_ANIMAL),
CAT(6, ABSTRACT_TAMEABLE_ANIMAL),
OCELOT(50, ABSTRACT_TAMEABLE_ANIMAL),
WOLF(93, ABSTRACT_TAMEABLE_ANIMAL),
ABSTRACT_PARROT(-1, ABSTRACT_TAMEABLE_ANIMAL),
PARROT(53, ABSTRACT_PARROT),
// Horses
ABSTRACT_HORSE(-1, ABSTRACT_ANIMAL),
CHESTED_HORSE(-1, ABSTRACT_HORSE),
DONKEY(12, CHESTED_HORSE),
MULE(48, CHESTED_HORSE),
LLAMA(38, CHESTED_HORSE),
TRADER_LLAMA(75, CHESTED_HORSE),
HORSE(31, ABSTRACT_HORSE),
SKELETON_HORSE(66, ABSTRACT_HORSE),
ZOMBIE_HORSE(95, ABSTRACT_HORSE),
// Golem
ABSTRACT_GOLEM(-1, ABSTRACT_CREATURE),
SNOW_GOLEM(69, ABSTRACT_GOLEM),
IRON_GOLEM(85, ABSTRACT_GOLEM),
SHULKER(62, ABSTRACT_GOLEM),
// Fish
ABSTRACT_FISHES(-1, ABSTRACT_CREATURE),
COD(9, ABSTRACT_FISHES),
PUFFERFISH(55, ABSTRACT_FISHES),
SALMON(60, ABSTRACT_FISHES),
TROPICAL_FISH(76, ABSTRACT_FISHES),
// Monsters
ABSTRACT_MONSTER(-1, ABSTRACT_CREATURE),
BLAZE(4, ABSTRACT_MONSTER),
CREEPER(11, ABSTRACT_MONSTER),
ENDERMITE(20, ABSTRACT_MONSTER),
ENDERMAN(19, ABSTRACT_MONSTER),
GIANT(29, ABSTRACT_MONSTER),
SILVERFISH(64, ABSTRACT_MONSTER),
VEX(83, ABSTRACT_MONSTER),
WITCH(89, ABSTRACT_MONSTER),
WITHER(90, ABSTRACT_MONSTER),
RAVAGER(98, ABSTRACT_MONSTER),
// Illagers
ABSTRACT_ILLAGER_BASE(-1, ABSTRACT_MONSTER),
ABSTRACT_EVO_ILLU_ILLAGER(-1, ABSTRACT_ILLAGER_BASE),
EVOKER(22, ABSTRACT_EVO_ILLU_ILLAGER),
ILLUSIONER(33, ABSTRACT_EVO_ILLU_ILLAGER),
VINDICATOR(86, ABSTRACT_ILLAGER_BASE),
PILLAGER(87, ABSTRACT_ILLAGER_BASE),
// Skeletons
ABSTRACT_SKELETON(-1, ABSTRACT_MONSTER),
SKELETON(65, ABSTRACT_SKELETON),
STRAY(74, ABSTRACT_SKELETON),
WITHER_SKELETON(91, ABSTRACT_SKELETON),
// Guardians
GUARDIAN(30, ABSTRACT_MONSTER),
ELDER_GUARDIAN(16, GUARDIAN),
// Spiders
SPIDER(72, ABSTRACT_MONSTER),
CAVE_SPIDER(7, SPIDER),
// Zombies - META CHECKED
ZOMBIE(94, ABSTRACT_MONSTER),
DROWNED(15, ZOMBIE),
HUSK(32, ZOMBIE),
ZOMBIE_PIGMAN(56, ZOMBIE),
ZOMBIE_VILLAGER(96, ZOMBIE),
// Flying entities
ABSTRACT_FLYING(-1, ABSTRACT_INSENTIENT),
GHAST(28, ABSTRACT_FLYING),
PHANTOM(97, ABSTRACT_FLYING),
ABSTRACT_AMBIENT(-1, ABSTRACT_INSENTIENT),
BAT(3, ABSTRACT_AMBIENT),
ABSTRACT_WATERMOB(-1, ABSTRACT_INSENTIENT),
SQUID(73, ABSTRACT_WATERMOB),
// Slimes
SLIME(67, ABSTRACT_INSENTIENT),
MAGMA_CUBE(40, SLIME),
// Hangable objects
ABSTRACT_HANGING(-1, ENTITY),
LEASH_KNOT(37, ABSTRACT_HANGING),
ITEM_FRAME(35, ABSTRACT_HANGING),
PAINTING(51, ABSTRACT_HANGING),
ABSTRACT_LIGHTNING(-1, ENTITY),
LIGHTNING_BOLT(99, ABSTRACT_LIGHTNING),
// Arrows
ABSTRACT_ARROW(-1, ENTITY),
ARROW(2, ABSTRACT_ARROW),
SPECTRAL_ARROW(71, ABSTRACT_ARROW),
TRIDENT(82, ABSTRACT_ARROW),
// Fireballs
ABSTRACT_FIREBALL(-1, ENTITY),
DRAGON_FIREBALL(14, ABSTRACT_FIREBALL),
FIREBALL(36, ABSTRACT_FIREBALL),
SMALL_FIREBALL(68, ABSTRACT_FIREBALL),
WITHER_SKULL(92, ABSTRACT_FIREBALL),
// Projectiles // Projectiles
PROJECTILE_ABSTRACT(-1, ENTITY), PROJECTILE_ABSTRACT(ENTITY, null), // Not actually its own abstract type, but useful for categorizing
SNOWBALL(70, PROJECTILE_ABSTRACT), SNOWBALL(PROJECTILE_ABSTRACT),
ENDER_PEARL(79, PROJECTILE_ABSTRACT), ENDER_PEARL(PROJECTILE_ABSTRACT),
EGG(78, PROJECTILE_ABSTRACT), EGG(PROJECTILE_ABSTRACT),
POTION(81, PROJECTILE_ABSTRACT), POTION(PROJECTILE_ABSTRACT),
EXPERIENCE_BOTTLE(80, PROJECTILE_ABSTRACT), EXPERIENCE_BOTTLE(PROJECTILE_ABSTRACT),
FIREWORK_ROCKET(PROJECTILE_ABSTRACT),
LLAMA_SPIT(PROJECTILE_ABSTRACT),
SHULKER_BULLET(PROJECTILE_ABSTRACT),
FISHING_BOBBER(PROJECTILE_ABSTRACT),
WITHER_SKULL(PROJECTILE_ABSTRACT),
DRAGON_FIREBALL(PROJECTILE_ABSTRACT), // Doesn't actually inherit fireball
ABSTRACT_ARROW(PROJECTILE_ABSTRACT, null),
ARROW(ABSTRACT_ARROW),
SPECTRAL_ARROW(ABSTRACT_ARROW),
TRIDENT(ABSTRACT_ARROW),
ABSTRACT_FIREBALL(ENTITY, null),
FIREBALL(ABSTRACT_FIREBALL),
SMALL_FIREBALL(ABSTRACT_FIREBALL),
// Vehicles // Vehicles
MINECART_ABSTRACT(-1, ENTITY), VEHICLE(ENTITY, null),
CHESTED_MINECART_ABSTRACT(-1, MINECART_ABSTRACT), BOAT(VEHICLE),
CHEST_MINECART(42, CHESTED_MINECART_ABSTRACT),
HOPPER_MINECART(45, CHESTED_MINECART_ABSTRACT),
MINECART(41, MINECART_ABSTRACT),
FURNACE_MINECART(44, MINECART_ABSTRACT),
COMMAND_BLOCK_MINECART(43, MINECART_ABSTRACT),
TNT_MINECART(47, MINECART_ABSTRACT),
SPAWNER_MINECART(46, MINECART_ABSTRACT),
BOAT(5, ENTITY);
private static final EntityType[] TYPES; MINECART_ABSTRACT(VEHICLE, null),
MINECART(MINECART_ABSTRACT),
FURNACE_MINECART(MINECART_ABSTRACT),
COMMAND_BLOCK_MINECART(MINECART_ABSTRACT),
TNT_MINECART(MINECART_ABSTRACT),
SPAWNER_MINECART(MINECART_ABSTRACT),
private final int id; CHESTED_MINECART_ABSTRACT(MINECART_ABSTRACT, null),
CHEST_MINECART(CHESTED_MINECART_ABSTRACT),
HOPPER_MINECART(CHESTED_MINECART_ABSTRACT),
// Living entities as a larger subclass
LIVINGENTITY(ENTITY, null),
ARMOR_STAND(LIVINGENTITY),
PLAYER(LIVINGENTITY),
// Mobs as a larger subclass
ABSTRACT_INSENTIENT(LIVINGENTITY, null),
ENDER_DRAGON(ABSTRACT_INSENTIENT),
SLIME(ABSTRACT_INSENTIENT),
MAGMA_CUBE(SLIME),
// Ambient mobs
ABSTRACT_AMBIENT(ABSTRACT_INSENTIENT, null),
BAT(ABSTRACT_AMBIENT),
// Flying mobs
ABSTRACT_FLYING(ABSTRACT_INSENTIENT, null),
GHAST(ABSTRACT_FLYING),
PHANTOM(ABSTRACT_FLYING),
// Pathfinder mobs and its subclasses
ABSTRACT_CREATURE(ABSTRACT_INSENTIENT, null),
ABSTRACT_GOLEM(ABSTRACT_CREATURE, null),
SNOW_GOLEM(ABSTRACT_GOLEM),
IRON_GOLEM(ABSTRACT_GOLEM),
SHULKER(ABSTRACT_GOLEM),
// Water mobs
ABSTRACT_WATERMOB(ABSTRACT_CREATURE, null),
DOLPHIN(ABSTRACT_WATERMOB),
SQUID(ABSTRACT_WATERMOB),
ABSTRACT_FISHES(ABSTRACT_WATERMOB, null),
PUFFERFISH(ABSTRACT_FISHES),
ABSTRACT_SCHOOLING_FISH(ABSTRACT_FISHES, null),
COD(ABSTRACT_SCHOOLING_FISH),
SALMON(ABSTRACT_SCHOOLING_FISH),
TROPICAL_FISH(ABSTRACT_SCHOOLING_FISH),
// Ageable mobs and (tamable) animals
ABSTRACT_AGEABLE(ABSTRACT_CREATURE, null),
ABSTRACT_VILLAGER(ABSTRACT_AGEABLE, null),
VILLAGER(ABSTRACT_VILLAGER),
WANDERING_TRADER(ABSTRACT_VILLAGER),
ABSTRACT_ANIMAL(ABSTRACT_AGEABLE, null),
CHICKEN(ABSTRACT_ANIMAL),
PANDA(ABSTRACT_ANIMAL),
PIG(ABSTRACT_ANIMAL),
POLAR_BEAR(ABSTRACT_ANIMAL),
RABBIT(ABSTRACT_ANIMAL),
SHEEP(ABSTRACT_ANIMAL),
TURTLE(ABSTRACT_ANIMAL),
FOX(ABSTRACT_ANIMAL),
COW(ABSTRACT_ANIMAL),
MOOSHROOM(COW),
ABSTRACT_TAMEABLE_ANIMAL(ABSTRACT_ANIMAL, null),
CAT(ABSTRACT_TAMEABLE_ANIMAL),
OCELOT(ABSTRACT_TAMEABLE_ANIMAL),
WOLF(ABSTRACT_TAMEABLE_ANIMAL),
PARROT(ABSTRACT_TAMEABLE_ANIMAL),
ABSTRACT_HORSE(ABSTRACT_ANIMAL, null),
HORSE(ABSTRACT_HORSE),
SKELETON_HORSE(ABSTRACT_HORSE),
ZOMBIE_HORSE(ABSTRACT_HORSE),
CHESTED_HORSE(ABSTRACT_HORSE, null),
DONKEY(CHESTED_HORSE),
MULE(CHESTED_HORSE),
LLAMA(CHESTED_HORSE),
TRADER_LLAMA(LLAMA),
// Monsters
ABSTRACT_MONSTER(ABSTRACT_CREATURE, null),
BLAZE(ABSTRACT_MONSTER),
CREEPER(ABSTRACT_MONSTER),
ENDERMITE(ABSTRACT_MONSTER),
ENDERMAN(ABSTRACT_MONSTER),
GIANT(ABSTRACT_MONSTER),
SILVERFISH(ABSTRACT_MONSTER),
VEX(ABSTRACT_MONSTER),
WITHER(ABSTRACT_MONSTER),
ABSTRACT_SKELETON(ABSTRACT_MONSTER, null),
SKELETON(ABSTRACT_SKELETON),
STRAY(ABSTRACT_SKELETON),
WITHER_SKELETON(ABSTRACT_SKELETON),
ZOMBIE(ABSTRACT_MONSTER),
DROWNED(ZOMBIE),
HUSK(ZOMBIE),
ZOMBIE_PIGMAN(ZOMBIE),
ZOMBIE_VILLAGER(ZOMBIE),
GUARDIAN(ABSTRACT_MONSTER),
ELDER_GUARDIAN(GUARDIAN),
SPIDER(ABSTRACT_MONSTER),
CAVE_SPIDER(SPIDER),
// Raiders
ABSTRACT_RAIDER(ABSTRACT_MONSTER, null),
WITCH(ABSTRACT_RAIDER),
RAVAGER(ABSTRACT_RAIDER),
ABSTRACT_ILLAGER_BASE(ABSTRACT_RAIDER, null),
ABSTRACT_EVO_ILLU_ILLAGER(ABSTRACT_ILLAGER_BASE, null),
VINDICATOR(ABSTRACT_ILLAGER_BASE),
PILLAGER(ABSTRACT_ILLAGER_BASE),
EVOKER(ABSTRACT_EVO_ILLU_ILLAGER),
ILLUSIONER(ABSTRACT_EVO_ILLU_ILLAGER);
private static final EntityType[] TYPES = EntityTypeUtil.createSizedArray(values());
private final EntityType parent; private final EntityType parent;
private final String identifier;
private int id = -1;
EntityTypes1_14(int id) { EntityTypes1_14(final EntityType parent) {
this.id = id; this.parent = parent;
this.parent = null; this.identifier = "minecraft:" + name().toLowerCase(Locale.ROOT);
} }
EntityTypes1_14(int id, EntityType parent) { EntityTypes1_14(final EntityType parent, @Nullable final String identifier) {
this.id = id;
this.parent = parent; this.parent = parent;
this.identifier = identifier;
} }
@Override @Override
public int getId() { public int getId() {
if (id == -1) {
throw new IllegalStateException("Ids have not been initialized yet (type " + name() + ")");
}
return id; return id;
} }
@Override @Override
public EntityType getParent() { public String identifier() {
Preconditions.checkArgument(identifier != null, "Called identifier method on abstract type");
return identifier;
}
@Override
public @Nullable EntityType getParent() {
return parent; return parent;
} }
@Override
public String identifier() {
throw new UnsupportedOperationException();
}
@Override @Override
public boolean isAbstractType() { public boolean isAbstractType() {
return id != -1; return identifier == null;
} }
static { public static EntityType getTypeFromId(final int typeId) {
TYPES = EntityTypeUtil.toOrderedArray(values());
}
public static EntityType getTypeFromId(int typeId) {
return EntityTypeUtil.getTypeFromId(TYPES, typeId, ENTITY); return EntityTypeUtil.getTypeFromId(TYPES, typeId, ENTITY);
} }
public static void initialize(final Protocol<?, ?, ?, ?> protocol) {
EntityTypeUtil.initialize(values(), TYPES, protocol, (type, id) -> type.id = id);
}
} }

Datei anzeigen

@ -22,225 +22,233 @@
*/ */
package com.viaversion.viaversion.api.minecraft.entities; package com.viaversion.viaversion.api.minecraft.entities;
import com.google.common.base.Preconditions;
import com.viaversion.viaversion.api.protocol.Protocol;
import com.viaversion.viaversion.util.EntityTypeUtil; import com.viaversion.viaversion.util.EntityTypeUtil;
import java.util.Locale;
import org.checkerframework.checker.nullness.qual.Nullable;
public enum EntityTypes1_15 implements EntityType { public enum EntityTypes1_15 implements EntityType {
ENTITY(-1), ENTITY(null, null),
AREA_EFFECT_CLOUD(0, ENTITY), AREA_EFFECT_CLOUD(ENTITY),
END_CRYSTAL(18, ENTITY), END_CRYSTAL(ENTITY),
EVOKER_FANGS(22, ENTITY), EVOKER_FANGS(ENTITY),
EXPERIENCE_ORB(24, ENTITY), EXPERIENCE_ORB(ENTITY),
EYE_OF_ENDER(25, ENTITY), EYE_OF_ENDER(ENTITY),
FALLING_BLOCK(26, ENTITY), FALLING_BLOCK(ENTITY),
FIREWORK_ROCKET(27, ENTITY), ITEM(ENTITY),
ITEM(35, ENTITY), TNT(ENTITY),
LLAMA_SPIT(40, ENTITY), LIGHTNING_BOLT(ENTITY),
TNT(59, ENTITY),
SHULKER_BULLET(64, ENTITY),
FISHING_BOBBER(102, ENTITY),
LIVINGENTITY(-1, ENTITY), // Hanging entities
ARMOR_STAND(1, LIVINGENTITY), ABSTRACT_HANGING(ENTITY, null),
PLAYER(101, LIVINGENTITY), LEASH_KNOT(ABSTRACT_HANGING),
PAINTING(ABSTRACT_HANGING),
ABSTRACT_INSENTIENT(-1, LIVINGENTITY), ITEM_FRAME(ABSTRACT_HANGING),
ENDER_DRAGON(19, ABSTRACT_INSENTIENT),
BEE(4, ABSTRACT_INSENTIENT),
ABSTRACT_CREATURE(-1, ABSTRACT_INSENTIENT),
ABSTRACT_AGEABLE(-1, ABSTRACT_CREATURE),
VILLAGER(85, ABSTRACT_AGEABLE),
WANDERING_TRADER(89, ABSTRACT_AGEABLE),
// Animals
ABSTRACT_ANIMAL(-1, ABSTRACT_AGEABLE),
DOLPHIN(14, ABSTRACT_INSENTIENT),
CHICKEN(9, ABSTRACT_ANIMAL),
COW(11, ABSTRACT_ANIMAL),
MOOSHROOM(50, COW),
PANDA(53, ABSTRACT_INSENTIENT),
PIG(55, ABSTRACT_ANIMAL),
POLAR_BEAR(58, ABSTRACT_ANIMAL),
RABBIT(60, ABSTRACT_ANIMAL),
SHEEP(62, ABSTRACT_ANIMAL),
TURTLE(78, ABSTRACT_ANIMAL),
FOX(28, ABSTRACT_ANIMAL),
ABSTRACT_TAMEABLE_ANIMAL(-1, ABSTRACT_ANIMAL),
CAT(7, ABSTRACT_TAMEABLE_ANIMAL),
OCELOT(51, ABSTRACT_TAMEABLE_ANIMAL),
WOLF(94, ABSTRACT_TAMEABLE_ANIMAL),
ABSTRACT_PARROT(-1, ABSTRACT_TAMEABLE_ANIMAL),
PARROT(54, ABSTRACT_PARROT),
// Horses
ABSTRACT_HORSE(-1, ABSTRACT_ANIMAL),
CHESTED_HORSE(-1, ABSTRACT_HORSE),
DONKEY(13, CHESTED_HORSE),
MULE(49, CHESTED_HORSE),
LLAMA(39, CHESTED_HORSE),
TRADER_LLAMA(76, CHESTED_HORSE),
HORSE(32, ABSTRACT_HORSE),
SKELETON_HORSE(67, ABSTRACT_HORSE),
ZOMBIE_HORSE(96, ABSTRACT_HORSE),
// Golem
ABSTRACT_GOLEM(-1, ABSTRACT_CREATURE),
SNOW_GOLEM(70, ABSTRACT_GOLEM),
IRON_GOLEM(86, ABSTRACT_GOLEM),
SHULKER(63, ABSTRACT_GOLEM),
// Fish
ABSTRACT_FISHES(-1, ABSTRACT_CREATURE),
COD(10, ABSTRACT_FISHES),
PUFFERFISH(56, ABSTRACT_FISHES),
SALMON(61, ABSTRACT_FISHES),
TROPICAL_FISH(77, ABSTRACT_FISHES),
// Monsters
ABSTRACT_MONSTER(-1, ABSTRACT_CREATURE),
BLAZE(5, ABSTRACT_MONSTER),
CREEPER(12, ABSTRACT_MONSTER),
ENDERMITE(21, ABSTRACT_MONSTER),
ENDERMAN(20, ABSTRACT_MONSTER),
GIANT(30, ABSTRACT_MONSTER),
SILVERFISH(65, ABSTRACT_MONSTER),
VEX(84, ABSTRACT_MONSTER),
WITCH(90, ABSTRACT_MONSTER),
WITHER(91, ABSTRACT_MONSTER),
RAVAGER(99, ABSTRACT_MONSTER),
// Illagers
ABSTRACT_ILLAGER_BASE(-1, ABSTRACT_MONSTER),
ABSTRACT_EVO_ILLU_ILLAGER(-1, ABSTRACT_ILLAGER_BASE),
EVOKER(23, ABSTRACT_EVO_ILLU_ILLAGER),
ILLUSIONER(34, ABSTRACT_EVO_ILLU_ILLAGER),
VINDICATOR(87, ABSTRACT_ILLAGER_BASE),
PILLAGER(88, ABSTRACT_ILLAGER_BASE),
// Skeletons
ABSTRACT_SKELETON(-1, ABSTRACT_MONSTER),
SKELETON(66, ABSTRACT_SKELETON),
STRAY(75, ABSTRACT_SKELETON),
WITHER_SKELETON(92, ABSTRACT_SKELETON),
// Guardians
GUARDIAN(31, ABSTRACT_MONSTER),
ELDER_GUARDIAN(17, GUARDIAN),
// Spiders
SPIDER(73, ABSTRACT_MONSTER),
CAVE_SPIDER(8, SPIDER),
// Zombies
ZOMBIE(95, ABSTRACT_MONSTER),
DROWNED(16, ZOMBIE),
HUSK(33, ZOMBIE),
ZOMBIE_PIGMAN(57, ZOMBIE),
ZOMBIE_VILLAGER(97, ZOMBIE),
// Flying entities
ABSTRACT_FLYING(-1, ABSTRACT_INSENTIENT),
GHAST(29, ABSTRACT_FLYING),
PHANTOM(98, ABSTRACT_FLYING),
ABSTRACT_AMBIENT(-1, ABSTRACT_INSENTIENT),
BAT(3, ABSTRACT_AMBIENT),
ABSTRACT_WATERMOB(-1, ABSTRACT_INSENTIENT),
SQUID(74, ABSTRACT_WATERMOB),
// Slimes
SLIME(68, ABSTRACT_INSENTIENT),
MAGMA_CUBE(41, SLIME),
// Hangable objects
ABSTRACT_HANGING(-1, ENTITY),
LEASH_KNOT(38, ABSTRACT_HANGING),
ITEM_FRAME(36, ABSTRACT_HANGING),
PAINTING(52, ABSTRACT_HANGING),
ABSTRACT_LIGHTNING(-1, ENTITY),
LIGHTNING_BOLT(100, ABSTRACT_LIGHTNING),
// Arrows
ABSTRACT_ARROW(-1, ENTITY),
ARROW(2, ABSTRACT_ARROW),
SPECTRAL_ARROW(72, ABSTRACT_ARROW),
TRIDENT(83, ABSTRACT_ARROW),
// Fireballs
ABSTRACT_FIREBALL(-1, ENTITY),
DRAGON_FIREBALL(15, ABSTRACT_FIREBALL),
FIREBALL(37, ABSTRACT_FIREBALL),
SMALL_FIREBALL(69, ABSTRACT_FIREBALL),
WITHER_SKULL(93, ABSTRACT_FIREBALL),
// Projectiles // Projectiles
PROJECTILE_ABSTRACT(-1, ENTITY), PROJECTILE_ABSTRACT(ENTITY, null), // Not actually its own abstract type, but useful for categorizing
SNOWBALL(71, PROJECTILE_ABSTRACT), SNOWBALL(PROJECTILE_ABSTRACT),
ENDER_PEARL(80, PROJECTILE_ABSTRACT), ENDER_PEARL(PROJECTILE_ABSTRACT),
EGG(79, PROJECTILE_ABSTRACT), EGG(PROJECTILE_ABSTRACT),
POTION(82, PROJECTILE_ABSTRACT), POTION(PROJECTILE_ABSTRACT),
EXPERIENCE_BOTTLE(81, PROJECTILE_ABSTRACT), EXPERIENCE_BOTTLE(PROJECTILE_ABSTRACT),
FIREWORK_ROCKET(PROJECTILE_ABSTRACT),
LLAMA_SPIT(PROJECTILE_ABSTRACT),
SHULKER_BULLET(PROJECTILE_ABSTRACT),
FISHING_BOBBER(PROJECTILE_ABSTRACT),
WITHER_SKULL(PROJECTILE_ABSTRACT),
DRAGON_FIREBALL(PROJECTILE_ABSTRACT), // Doesn't actually inherit fireball
ABSTRACT_ARROW(PROJECTILE_ABSTRACT, null),
ARROW(ABSTRACT_ARROW),
SPECTRAL_ARROW(ABSTRACT_ARROW),
TRIDENT(ABSTRACT_ARROW),
ABSTRACT_FIREBALL(ENTITY, null),
FIREBALL(ABSTRACT_FIREBALL),
SMALL_FIREBALL(ABSTRACT_FIREBALL),
// Vehicles // Vehicles
MINECART_ABSTRACT(-1, ENTITY), VEHICLE(ENTITY, null),
CHESTED_MINECART_ABSTRACT(-1, MINECART_ABSTRACT), BOAT(VEHICLE),
CHEST_MINECART(43, CHESTED_MINECART_ABSTRACT),
HOPPER_MINECART(46, CHESTED_MINECART_ABSTRACT),
MINECART(42, MINECART_ABSTRACT),
FURNACE_MINECART(45, MINECART_ABSTRACT),
COMMAND_BLOCK_MINECART(44, MINECART_ABSTRACT),
TNT_MINECART(48, MINECART_ABSTRACT),
SPAWNER_MINECART(47, MINECART_ABSTRACT),
BOAT(6, ENTITY);
private static final EntityType[] TYPES; MINECART_ABSTRACT(VEHICLE, null),
MINECART(MINECART_ABSTRACT),
FURNACE_MINECART(MINECART_ABSTRACT),
COMMAND_BLOCK_MINECART(MINECART_ABSTRACT),
TNT_MINECART(MINECART_ABSTRACT),
SPAWNER_MINECART(MINECART_ABSTRACT),
private final int id; CHESTED_MINECART_ABSTRACT(MINECART_ABSTRACT, null),
CHEST_MINECART(CHESTED_MINECART_ABSTRACT),
HOPPER_MINECART(CHESTED_MINECART_ABSTRACT),
// Living entities as a larger subclass
LIVINGENTITY(ENTITY, null),
ARMOR_STAND(LIVINGENTITY),
PLAYER(LIVINGENTITY),
// Mobs as a larger subclass
ABSTRACT_INSENTIENT(LIVINGENTITY, null),
ENDER_DRAGON(ABSTRACT_INSENTIENT),
SLIME(ABSTRACT_INSENTIENT),
MAGMA_CUBE(SLIME),
// Ambient mobs
ABSTRACT_AMBIENT(ABSTRACT_INSENTIENT, null),
BAT(ABSTRACT_AMBIENT),
// Flying mobs
ABSTRACT_FLYING(ABSTRACT_INSENTIENT, null),
GHAST(ABSTRACT_FLYING),
PHANTOM(ABSTRACT_FLYING),
// Pathfinder mobs and its subclasses
ABSTRACT_CREATURE(ABSTRACT_INSENTIENT, null),
ABSTRACT_GOLEM(ABSTRACT_CREATURE, null),
SNOW_GOLEM(ABSTRACT_GOLEM),
IRON_GOLEM(ABSTRACT_GOLEM),
SHULKER(ABSTRACT_GOLEM),
// Water mobs
ABSTRACT_WATERMOB(ABSTRACT_CREATURE, null),
DOLPHIN(ABSTRACT_WATERMOB),
SQUID(ABSTRACT_WATERMOB),
ABSTRACT_FISHES(ABSTRACT_WATERMOB, null),
PUFFERFISH(ABSTRACT_FISHES),
ABSTRACT_SCHOOLING_FISH(ABSTRACT_FISHES, null),
COD(ABSTRACT_SCHOOLING_FISH),
SALMON(ABSTRACT_SCHOOLING_FISH),
TROPICAL_FISH(ABSTRACT_SCHOOLING_FISH),
// Ageable mobs and (tamable) animals
ABSTRACT_AGEABLE(ABSTRACT_CREATURE, null),
ABSTRACT_VILLAGER(ABSTRACT_AGEABLE, null),
VILLAGER(ABSTRACT_VILLAGER),
WANDERING_TRADER(ABSTRACT_VILLAGER),
ABSTRACT_ANIMAL(ABSTRACT_AGEABLE, null),
CHICKEN(ABSTRACT_ANIMAL),
PANDA(ABSTRACT_ANIMAL),
PIG(ABSTRACT_ANIMAL),
POLAR_BEAR(ABSTRACT_ANIMAL),
RABBIT(ABSTRACT_ANIMAL),
SHEEP(ABSTRACT_ANIMAL),
BEE(ABSTRACT_ANIMAL),
TURTLE(ABSTRACT_ANIMAL),
FOX(ABSTRACT_ANIMAL),
COW(ABSTRACT_ANIMAL),
MOOSHROOM(COW),
ABSTRACT_TAMEABLE_ANIMAL(ABSTRACT_ANIMAL, null),
CAT(ABSTRACT_TAMEABLE_ANIMAL),
OCELOT(ABSTRACT_TAMEABLE_ANIMAL),
WOLF(ABSTRACT_TAMEABLE_ANIMAL),
PARROT(ABSTRACT_TAMEABLE_ANIMAL),
ABSTRACT_HORSE(ABSTRACT_ANIMAL, null),
HORSE(ABSTRACT_HORSE),
SKELETON_HORSE(ABSTRACT_HORSE),
ZOMBIE_HORSE(ABSTRACT_HORSE),
CHESTED_HORSE(ABSTRACT_HORSE, null),
DONKEY(CHESTED_HORSE),
MULE(CHESTED_HORSE),
LLAMA(CHESTED_HORSE),
TRADER_LLAMA(LLAMA),
// Monsters
ABSTRACT_MONSTER(ABSTRACT_CREATURE, null),
BLAZE(ABSTRACT_MONSTER),
CREEPER(ABSTRACT_MONSTER),
ENDERMITE(ABSTRACT_MONSTER),
ENDERMAN(ABSTRACT_MONSTER),
GIANT(ABSTRACT_MONSTER),
SILVERFISH(ABSTRACT_MONSTER),
VEX(ABSTRACT_MONSTER),
WITHER(ABSTRACT_MONSTER),
ABSTRACT_SKELETON(ABSTRACT_MONSTER, null),
SKELETON(ABSTRACT_SKELETON),
STRAY(ABSTRACT_SKELETON),
WITHER_SKELETON(ABSTRACT_SKELETON),
ZOMBIE(ABSTRACT_MONSTER),
DROWNED(ZOMBIE),
HUSK(ZOMBIE),
ZOMBIE_PIGMAN(ZOMBIE),
ZOMBIE_VILLAGER(ZOMBIE),
GUARDIAN(ABSTRACT_MONSTER),
ELDER_GUARDIAN(GUARDIAN),
SPIDER(ABSTRACT_MONSTER),
CAVE_SPIDER(SPIDER),
// Raiders
ABSTRACT_RAIDER(ABSTRACT_MONSTER, null),
WITCH(ABSTRACT_RAIDER),
RAVAGER(ABSTRACT_RAIDER),
ABSTRACT_ILLAGER_BASE(ABSTRACT_RAIDER, null),
ABSTRACT_EVO_ILLU_ILLAGER(ABSTRACT_ILLAGER_BASE, null),
VINDICATOR(ABSTRACT_ILLAGER_BASE),
PILLAGER(ABSTRACT_ILLAGER_BASE),
EVOKER(ABSTRACT_EVO_ILLU_ILLAGER),
ILLUSIONER(ABSTRACT_EVO_ILLU_ILLAGER);
private static final EntityType[] TYPES = EntityTypeUtil.createSizedArray(values());
private final EntityType parent; private final EntityType parent;
private final String identifier;
private int id = -1;
EntityTypes1_15(int id) { EntityTypes1_15(final EntityType parent) {
this.id = id; this.parent = parent;
this.parent = null; this.identifier = "minecraft:" + name().toLowerCase(Locale.ROOT);
} }
EntityTypes1_15(int id, EntityType parent) { EntityTypes1_15(final EntityType parent, @Nullable final String identifier) {
this.id = id;
this.parent = parent; this.parent = parent;
this.identifier = identifier;
} }
@Override @Override
public int getId() { public int getId() {
if (id == -1) {
throw new IllegalStateException("Ids have not been initialized yet (type " + name() + ")");
}
return id; return id;
} }
@Override @Override
public EntityType getParent() { public String identifier() {
Preconditions.checkArgument(identifier != null, "Called identifier method on abstract type");
return identifier;
}
@Override
public @Nullable EntityType getParent() {
return parent; return parent;
} }
@Override
public String identifier() {
throw new UnsupportedOperationException();
}
@Override @Override
public boolean isAbstractType() { public boolean isAbstractType() {
return id != -1; return identifier == null;
} }
static { public static EntityType getTypeFromId(final int typeId) {
TYPES = EntityTypeUtil.toOrderedArray(values());
}
public static EntityType getTypeFromId(int typeId) {
return EntityTypeUtil.getTypeFromId(TYPES, typeId, ENTITY); return EntityTypeUtil.getTypeFromId(TYPES, typeId, ENTITY);
} }
public static void initialize(final Protocol<?, ?, ?, ?> protocol) {
EntityTypeUtil.initialize(values(), TYPES, protocol, (type, id) -> type.id = id);
}
} }

Datei anzeigen

@ -22,230 +22,237 @@
*/ */
package com.viaversion.viaversion.api.minecraft.entities; package com.viaversion.viaversion.api.minecraft.entities;
import com.google.common.base.Preconditions;
import com.viaversion.viaversion.api.protocol.Protocol;
import com.viaversion.viaversion.util.EntityTypeUtil; import com.viaversion.viaversion.util.EntityTypeUtil;
import java.util.Locale;
import org.checkerframework.checker.nullness.qual.Nullable;
public enum EntityTypes1_16 implements EntityType { public enum EntityTypes1_16 implements EntityType {
ENTITY(-1), ENTITY(null, null),
AREA_EFFECT_CLOUD(0, ENTITY), AREA_EFFECT_CLOUD(ENTITY),
END_CRYSTAL(18, ENTITY), END_CRYSTAL(ENTITY),
EVOKER_FANGS(23, ENTITY), EVOKER_FANGS(ENTITY),
EXPERIENCE_ORB(24, ENTITY), EXPERIENCE_ORB(ENTITY),
EYE_OF_ENDER(25, ENTITY), EYE_OF_ENDER(ENTITY),
FALLING_BLOCK(26, ENTITY), FALLING_BLOCK(ENTITY),
FIREWORK_ROCKET(27, ENTITY), ITEM(ENTITY),
ITEM(37, ENTITY), TNT(ENTITY),
LLAMA_SPIT(43, ENTITY), LIGHTNING_BOLT(ENTITY),
TNT(63, ENTITY),
SHULKER_BULLET(70, ENTITY),
FISHING_BOBBER(106, ENTITY),
LIVINGENTITY(-1, ENTITY), // Hanging entities
ARMOR_STAND(1, LIVINGENTITY), ABSTRACT_HANGING(ENTITY, null),
PLAYER(105, LIVINGENTITY), LEASH_KNOT(ABSTRACT_HANGING),
PAINTING(ABSTRACT_HANGING),
ABSTRACT_INSENTIENT(-1, LIVINGENTITY), ITEM_FRAME(ABSTRACT_HANGING),
ENDER_DRAGON(19, ABSTRACT_INSENTIENT),
BEE(4, ABSTRACT_INSENTIENT),
ABSTRACT_CREATURE(-1, ABSTRACT_INSENTIENT),
ABSTRACT_AGEABLE(-1, ABSTRACT_CREATURE),
VILLAGER(92, ABSTRACT_AGEABLE),
WANDERING_TRADER(94, ABSTRACT_AGEABLE),
// Animals
ABSTRACT_ANIMAL(-1, ABSTRACT_AGEABLE),
DOLPHIN(13, ABSTRACT_INSENTIENT),
CHICKEN(9, ABSTRACT_ANIMAL),
COW(11, ABSTRACT_ANIMAL),
MOOSHROOM(53, COW),
PANDA(56, ABSTRACT_INSENTIENT),
PIG(59, ABSTRACT_ANIMAL),
POLAR_BEAR(62, ABSTRACT_ANIMAL),
RABBIT(65, ABSTRACT_ANIMAL),
SHEEP(68, ABSTRACT_ANIMAL),
TURTLE(90, ABSTRACT_ANIMAL),
FOX(28, ABSTRACT_ANIMAL),
ABSTRACT_TAMEABLE_ANIMAL(-1, ABSTRACT_ANIMAL),
CAT(7, ABSTRACT_TAMEABLE_ANIMAL),
OCELOT(54, ABSTRACT_TAMEABLE_ANIMAL),
WOLF(99, ABSTRACT_TAMEABLE_ANIMAL),
ABSTRACT_PARROT(-1, ABSTRACT_TAMEABLE_ANIMAL),
PARROT(57, ABSTRACT_PARROT),
// Horses
ABSTRACT_HORSE(-1, ABSTRACT_ANIMAL),
CHESTED_HORSE(-1, ABSTRACT_HORSE),
DONKEY(14, CHESTED_HORSE),
MULE(52, CHESTED_HORSE),
LLAMA(42, CHESTED_HORSE),
TRADER_LLAMA(88, CHESTED_HORSE),
HORSE(33, ABSTRACT_HORSE),
SKELETON_HORSE(73, ABSTRACT_HORSE),
ZOMBIE_HORSE(102, ABSTRACT_HORSE),
// Golem
ABSTRACT_GOLEM(-1, ABSTRACT_CREATURE),
SNOW_GOLEM(76, ABSTRACT_GOLEM),
IRON_GOLEM(36, ABSTRACT_GOLEM),
SHULKER(69, ABSTRACT_GOLEM),
// Fish
ABSTRACT_FISHES(-1, ABSTRACT_CREATURE),
COD(10, ABSTRACT_FISHES),
PUFFERFISH(64, ABSTRACT_FISHES),
SALMON(67, ABSTRACT_FISHES),
TROPICAL_FISH(89, ABSTRACT_FISHES),
// Monsters
ABSTRACT_MONSTER(-1, ABSTRACT_CREATURE),
BLAZE(5, ABSTRACT_MONSTER),
CREEPER(12, ABSTRACT_MONSTER),
ENDERMITE(21, ABSTRACT_MONSTER),
ENDERMAN(20, ABSTRACT_MONSTER),
GIANT(30, ABSTRACT_MONSTER),
SILVERFISH(71, ABSTRACT_MONSTER),
VEX(91, ABSTRACT_MONSTER),
WITCH(95, ABSTRACT_MONSTER),
WITHER(96, ABSTRACT_MONSTER),
RAVAGER(66, ABSTRACT_MONSTER),
PIGLIN(60, ABSTRACT_MONSTER),
HOGLIN(32, ABSTRACT_ANIMAL),
STRIDER(82, ABSTRACT_ANIMAL),
ZOGLIN(100, ABSTRACT_MONSTER),
// Illagers
ABSTRACT_ILLAGER_BASE(-1, ABSTRACT_MONSTER),
ABSTRACT_EVO_ILLU_ILLAGER(-1, ABSTRACT_ILLAGER_BASE),
EVOKER(22, ABSTRACT_EVO_ILLU_ILLAGER),
ILLUSIONER(35, ABSTRACT_EVO_ILLU_ILLAGER),
VINDICATOR(93, ABSTRACT_ILLAGER_BASE),
PILLAGER(61, ABSTRACT_ILLAGER_BASE),
// Skeletons
ABSTRACT_SKELETON(-1, ABSTRACT_MONSTER),
SKELETON(72, ABSTRACT_SKELETON),
STRAY(81, ABSTRACT_SKELETON),
WITHER_SKELETON(97, ABSTRACT_SKELETON),
// Guardians
GUARDIAN(31, ABSTRACT_MONSTER),
ELDER_GUARDIAN(17, GUARDIAN),
// Spiders
SPIDER(79, ABSTRACT_MONSTER),
CAVE_SPIDER(8, SPIDER),
// Zombies
ZOMBIE(101, ABSTRACT_MONSTER),
DROWNED(16, ZOMBIE),
HUSK(34, ZOMBIE),
ZOMBIFIED_PIGLIN(104, ZOMBIE),
ZOMBIE_VILLAGER(103, ZOMBIE),
// Flying entities
ABSTRACT_FLYING(-1, ABSTRACT_INSENTIENT),
GHAST(29, ABSTRACT_FLYING),
PHANTOM(58, ABSTRACT_FLYING),
ABSTRACT_AMBIENT(-1, ABSTRACT_INSENTIENT),
BAT(3, ABSTRACT_AMBIENT),
ABSTRACT_WATERMOB(-1, ABSTRACT_INSENTIENT),
SQUID(80, ABSTRACT_WATERMOB),
// Slimes
SLIME(74, ABSTRACT_INSENTIENT),
MAGMA_CUBE(44, SLIME),
// Hangable objects
ABSTRACT_HANGING(-1, ENTITY),
LEASH_KNOT(40, ABSTRACT_HANGING),
ITEM_FRAME(38, ABSTRACT_HANGING),
PAINTING(55, ABSTRACT_HANGING),
ABSTRACT_LIGHTNING(-1, ENTITY),
LIGHTNING_BOLT(41, ABSTRACT_LIGHTNING),
// Arrows
ABSTRACT_ARROW(-1, ENTITY),
ARROW(2, ABSTRACT_ARROW),
SPECTRAL_ARROW(78, ABSTRACT_ARROW),
TRIDENT(87, ABSTRACT_ARROW),
// Fireballs
ABSTRACT_FIREBALL(-1, ENTITY),
DRAGON_FIREBALL(15, ABSTRACT_FIREBALL),
FIREBALL(39, ABSTRACT_FIREBALL),
SMALL_FIREBALL(75, ABSTRACT_FIREBALL),
WITHER_SKULL(98, ABSTRACT_FIREBALL),
// Projectiles // Projectiles
PROJECTILE_ABSTRACT(-1, ENTITY), PROJECTILE_ABSTRACT(ENTITY, null), // Not actually its own abstract type, but useful for categorizing
SNOWBALL(77, PROJECTILE_ABSTRACT), SNOWBALL(PROJECTILE_ABSTRACT),
ENDER_PEARL(84, PROJECTILE_ABSTRACT), ENDER_PEARL(PROJECTILE_ABSTRACT),
EGG(83, PROJECTILE_ABSTRACT), EGG(PROJECTILE_ABSTRACT),
POTION(86, PROJECTILE_ABSTRACT), POTION(PROJECTILE_ABSTRACT),
EXPERIENCE_BOTTLE(85, PROJECTILE_ABSTRACT), EXPERIENCE_BOTTLE(PROJECTILE_ABSTRACT),
FIREWORK_ROCKET(PROJECTILE_ABSTRACT),
LLAMA_SPIT(PROJECTILE_ABSTRACT),
SHULKER_BULLET(PROJECTILE_ABSTRACT),
FISHING_BOBBER(PROJECTILE_ABSTRACT),
WITHER_SKULL(PROJECTILE_ABSTRACT),
DRAGON_FIREBALL(PROJECTILE_ABSTRACT), // Doesn't actually inherit fireball
ABSTRACT_ARROW(PROJECTILE_ABSTRACT, null),
ARROW(ABSTRACT_ARROW),
SPECTRAL_ARROW(ABSTRACT_ARROW),
TRIDENT(ABSTRACT_ARROW),
ABSTRACT_FIREBALL(ENTITY, null),
FIREBALL(ABSTRACT_FIREBALL),
SMALL_FIREBALL(ABSTRACT_FIREBALL),
// Vehicles // Vehicles
MINECART_ABSTRACT(-1, ENTITY), VEHICLE(ENTITY, null),
CHESTED_MINECART_ABSTRACT(-1, MINECART_ABSTRACT), BOAT(VEHICLE),
CHEST_MINECART(46, CHESTED_MINECART_ABSTRACT),
HOPPER_MINECART(49, CHESTED_MINECART_ABSTRACT),
MINECART(45, MINECART_ABSTRACT),
FURNACE_MINECART(48, MINECART_ABSTRACT),
COMMAND_BLOCK_MINECART(47, MINECART_ABSTRACT),
TNT_MINECART(51, MINECART_ABSTRACT),
SPAWNER_MINECART(50, MINECART_ABSTRACT),
BOAT(6, ENTITY);
private static final EntityType[] TYPES; MINECART_ABSTRACT(VEHICLE, null),
MINECART(MINECART_ABSTRACT),
FURNACE_MINECART(MINECART_ABSTRACT),
COMMAND_BLOCK_MINECART(MINECART_ABSTRACT),
TNT_MINECART(MINECART_ABSTRACT),
SPAWNER_MINECART(MINECART_ABSTRACT),
private final int id; CHESTED_MINECART_ABSTRACT(MINECART_ABSTRACT, null),
CHEST_MINECART(CHESTED_MINECART_ABSTRACT),
HOPPER_MINECART(CHESTED_MINECART_ABSTRACT),
// Living entities as a larger subclass
LIVINGENTITY(ENTITY, null),
ARMOR_STAND(LIVINGENTITY),
PLAYER(LIVINGENTITY),
// Mobs as a larger subclass
ABSTRACT_INSENTIENT(LIVINGENTITY, null),
ENDER_DRAGON(ABSTRACT_INSENTIENT),
SLIME(ABSTRACT_INSENTIENT),
MAGMA_CUBE(SLIME),
// Ambient mobs
ABSTRACT_AMBIENT(ABSTRACT_INSENTIENT, null),
BAT(ABSTRACT_AMBIENT),
// Flying mobs
ABSTRACT_FLYING(ABSTRACT_INSENTIENT, null),
GHAST(ABSTRACT_FLYING),
PHANTOM(ABSTRACT_FLYING),
// Pathfinder mobs and its subclasses
ABSTRACT_CREATURE(ABSTRACT_INSENTIENT, null),
ABSTRACT_GOLEM(ABSTRACT_CREATURE, null),
SNOW_GOLEM(ABSTRACT_GOLEM),
IRON_GOLEM(ABSTRACT_GOLEM),
SHULKER(ABSTRACT_GOLEM),
// Water mobs
ABSTRACT_WATERMOB(ABSTRACT_CREATURE, null),
DOLPHIN(ABSTRACT_WATERMOB),
SQUID(ABSTRACT_WATERMOB),
ABSTRACT_FISHES(ABSTRACT_WATERMOB, null),
PUFFERFISH(ABSTRACT_FISHES),
ABSTRACT_SCHOOLING_FISH(ABSTRACT_FISHES, null),
COD(ABSTRACT_SCHOOLING_FISH),
SALMON(ABSTRACT_SCHOOLING_FISH),
TROPICAL_FISH(ABSTRACT_SCHOOLING_FISH),
// Ageable mobs and (tamable) animals
ABSTRACT_AGEABLE(ABSTRACT_CREATURE, null),
ABSTRACT_VILLAGER(ABSTRACT_AGEABLE, null),
VILLAGER(ABSTRACT_VILLAGER),
WANDERING_TRADER(ABSTRACT_VILLAGER),
ABSTRACT_ANIMAL(ABSTRACT_AGEABLE, null),
CHICKEN(ABSTRACT_ANIMAL),
PANDA(ABSTRACT_ANIMAL),
PIG(ABSTRACT_ANIMAL),
POLAR_BEAR(ABSTRACT_ANIMAL),
RABBIT(ABSTRACT_ANIMAL),
SHEEP(ABSTRACT_ANIMAL),
BEE(ABSTRACT_ANIMAL),
TURTLE(ABSTRACT_ANIMAL),
FOX(ABSTRACT_ANIMAL),
HOGLIN(ABSTRACT_ANIMAL),
STRIDER(ABSTRACT_ANIMAL),
COW(ABSTRACT_ANIMAL),
MOOSHROOM(COW),
ABSTRACT_TAMEABLE_ANIMAL(ABSTRACT_ANIMAL, null),
CAT(ABSTRACT_TAMEABLE_ANIMAL),
OCELOT(ABSTRACT_TAMEABLE_ANIMAL),
WOLF(ABSTRACT_TAMEABLE_ANIMAL),
PARROT(ABSTRACT_TAMEABLE_ANIMAL),
ABSTRACT_HORSE(ABSTRACT_ANIMAL, null),
HORSE(ABSTRACT_HORSE),
SKELETON_HORSE(ABSTRACT_HORSE),
ZOMBIE_HORSE(ABSTRACT_HORSE),
CHESTED_HORSE(ABSTRACT_HORSE, null),
DONKEY(CHESTED_HORSE),
MULE(CHESTED_HORSE),
LLAMA(CHESTED_HORSE),
TRADER_LLAMA(LLAMA),
// Monsters
ABSTRACT_MONSTER(ABSTRACT_CREATURE, null),
BLAZE(ABSTRACT_MONSTER),
CREEPER(ABSTRACT_MONSTER),
ENDERMITE(ABSTRACT_MONSTER),
ENDERMAN(ABSTRACT_MONSTER),
GIANT(ABSTRACT_MONSTER),
SILVERFISH(ABSTRACT_MONSTER),
VEX(ABSTRACT_MONSTER),
WITHER(ABSTRACT_MONSTER),
ZOGLIN(ABSTRACT_MONSTER),
PIGLIN(ABSTRACT_MONSTER),
ABSTRACT_SKELETON(ABSTRACT_MONSTER, null),
SKELETON(ABSTRACT_SKELETON),
STRAY(ABSTRACT_SKELETON),
WITHER_SKELETON(ABSTRACT_SKELETON),
ZOMBIE(ABSTRACT_MONSTER),
DROWNED(ZOMBIE),
HUSK(ZOMBIE),
ZOMBIFIED_PIGLIN(ZOMBIE),
ZOMBIE_VILLAGER(ZOMBIE),
GUARDIAN(ABSTRACT_MONSTER),
ELDER_GUARDIAN(GUARDIAN),
SPIDER(ABSTRACT_MONSTER),
CAVE_SPIDER(SPIDER),
// Raiders
ABSTRACT_RAIDER(ABSTRACT_MONSTER, null),
WITCH(ABSTRACT_RAIDER),
RAVAGER(ABSTRACT_RAIDER),
ABSTRACT_ILLAGER_BASE(ABSTRACT_RAIDER, null),
ABSTRACT_EVO_ILLU_ILLAGER(ABSTRACT_ILLAGER_BASE, null),
VINDICATOR(ABSTRACT_ILLAGER_BASE),
PILLAGER(ABSTRACT_ILLAGER_BASE),
EVOKER(ABSTRACT_EVO_ILLU_ILLAGER),
ILLUSIONER(ABSTRACT_EVO_ILLU_ILLAGER);
private static final EntityType[] TYPES = EntityTypeUtil.createSizedArray(values());
private final EntityType parent; private final EntityType parent;
private final String identifier;
private int id = -1;
EntityTypes1_16(int id) { EntityTypes1_16(final EntityType parent) {
this.id = id; this.parent = parent;
this.parent = null; this.identifier = "minecraft:" + name().toLowerCase(Locale.ROOT);
} }
EntityTypes1_16(int id, EntityType parent) { EntityTypes1_16(final EntityType parent, @Nullable final String identifier) {
this.id = id;
this.parent = parent; this.parent = parent;
this.identifier = identifier;
} }
@Override @Override
public int getId() { public int getId() {
if (id == -1) {
throw new IllegalStateException("Ids have not been initialized yet (type " + name() + ")");
}
return id; return id;
} }
@Override @Override
public EntityType getParent() { public String identifier() {
Preconditions.checkArgument(identifier != null, "Called identifier method on abstract type");
return identifier;
}
@Override
public @Nullable EntityType getParent() {
return parent; return parent;
} }
@Override
public String identifier() {
throw new UnsupportedOperationException();
}
@Override @Override
public boolean isAbstractType() { public boolean isAbstractType() {
return id != -1; return identifier == null;
} }
static { public static EntityType getTypeFromId(final int typeId) {
TYPES = EntityTypeUtil.toOrderedArray(values());
}
public static EntityType getTypeFromId(int typeId) {
return EntityTypeUtil.getTypeFromId(TYPES, typeId, ENTITY); return EntityTypeUtil.getTypeFromId(TYPES, typeId, ENTITY);
} }
public static void initialize(final Protocol<?, ?, ?, ?> protocol) {
EntityTypeUtil.initialize(values(), TYPES, protocol, (type, id) -> type.id = id);
}
} }

Datei anzeigen

@ -22,234 +22,240 @@
*/ */
package com.viaversion.viaversion.api.minecraft.entities; package com.viaversion.viaversion.api.minecraft.entities;
import com.google.common.base.Preconditions;
import com.viaversion.viaversion.api.protocol.Protocol;
import com.viaversion.viaversion.util.EntityTypeUtil; import com.viaversion.viaversion.util.EntityTypeUtil;
import java.util.Locale;
import org.checkerframework.checker.nullness.qual.Nullable;
public enum EntityTypes1_16_2 implements EntityType { public enum EntityTypes1_16_2 implements EntityType {
ENTITY(-1), ENTITY(null, null),
AREA_EFFECT_CLOUD(0, ENTITY), AREA_EFFECT_CLOUD(ENTITY),
END_CRYSTAL(18, ENTITY), END_CRYSTAL(ENTITY),
EVOKER_FANGS(23, ENTITY), EVOKER_FANGS(ENTITY),
EXPERIENCE_ORB(24, ENTITY), EXPERIENCE_ORB(ENTITY),
EYE_OF_ENDER(25, ENTITY), EYE_OF_ENDER(ENTITY),
FALLING_BLOCK(26, ENTITY), FALLING_BLOCK(ENTITY),
FIREWORK_ROCKET(27, ENTITY), ITEM(ENTITY),
ITEM(37, ENTITY), TNT(ENTITY),
LLAMA_SPIT(43, ENTITY), LIGHTNING_BOLT(ENTITY),
TNT(64, ENTITY),
SHULKER_BULLET(71, ENTITY),
FISHING_BOBBER(107, ENTITY),
LIVINGENTITY(-1, ENTITY), // Hanging entities
ARMOR_STAND(1, LIVINGENTITY), ABSTRACT_HANGING(ENTITY, null),
PLAYER(106, LIVINGENTITY), LEASH_KNOT(ABSTRACT_HANGING),
PAINTING(ABSTRACT_HANGING),
ABSTRACT_INSENTIENT(-1, LIVINGENTITY), ITEM_FRAME(ABSTRACT_HANGING),
ENDER_DRAGON(19, ABSTRACT_INSENTIENT),
BEE(4, ABSTRACT_INSENTIENT),
ABSTRACT_CREATURE(-1, ABSTRACT_INSENTIENT),
ABSTRACT_AGEABLE(-1, ABSTRACT_CREATURE),
VILLAGER(93, ABSTRACT_AGEABLE),
WANDERING_TRADER(95, ABSTRACT_AGEABLE),
// Animals
ABSTRACT_ANIMAL(-1, ABSTRACT_AGEABLE),
DOLPHIN(13, ABSTRACT_INSENTIENT),
CHICKEN(9, ABSTRACT_ANIMAL),
COW(11, ABSTRACT_ANIMAL),
MOOSHROOM(53, COW),
PANDA(56, ABSTRACT_INSENTIENT),
PIG(59, ABSTRACT_ANIMAL),
POLAR_BEAR(63, ABSTRACT_ANIMAL),
RABBIT(66, ABSTRACT_ANIMAL),
SHEEP(69, ABSTRACT_ANIMAL),
TURTLE(91, ABSTRACT_ANIMAL),
FOX(28, ABSTRACT_ANIMAL),
ABSTRACT_TAMEABLE_ANIMAL(-1, ABSTRACT_ANIMAL),
CAT(7, ABSTRACT_TAMEABLE_ANIMAL),
OCELOT(54, ABSTRACT_TAMEABLE_ANIMAL),
WOLF(100, ABSTRACT_TAMEABLE_ANIMAL),
ABSTRACT_PARROT(-1, ABSTRACT_TAMEABLE_ANIMAL),
PARROT(57, ABSTRACT_PARROT),
// Horses
ABSTRACT_HORSE(-1, ABSTRACT_ANIMAL),
CHESTED_HORSE(-1, ABSTRACT_HORSE),
DONKEY(14, CHESTED_HORSE),
MULE(52, CHESTED_HORSE),
LLAMA(42, CHESTED_HORSE),
TRADER_LLAMA(89, CHESTED_HORSE),
HORSE(33, ABSTRACT_HORSE),
SKELETON_HORSE(74, ABSTRACT_HORSE),
ZOMBIE_HORSE(103, ABSTRACT_HORSE),
// Golem
ABSTRACT_GOLEM(-1, ABSTRACT_CREATURE),
SNOW_GOLEM(77, ABSTRACT_GOLEM),
IRON_GOLEM(36, ABSTRACT_GOLEM),
SHULKER(70, ABSTRACT_GOLEM),
// Fish
ABSTRACT_FISHES(-1, ABSTRACT_CREATURE),
COD(10, ABSTRACT_FISHES),
PUFFERFISH(65, ABSTRACT_FISHES),
SALMON(68, ABSTRACT_FISHES),
TROPICAL_FISH(90, ABSTRACT_FISHES),
// Monsters
ABSTRACT_MONSTER(-1, ABSTRACT_CREATURE),
BLAZE(5, ABSTRACT_MONSTER),
CREEPER(12, ABSTRACT_MONSTER),
ENDERMITE(21, ABSTRACT_MONSTER),
ENDERMAN(20, ABSTRACT_MONSTER),
GIANT(30, ABSTRACT_MONSTER),
SILVERFISH(72, ABSTRACT_MONSTER),
VEX(92, ABSTRACT_MONSTER),
WITCH(96, ABSTRACT_MONSTER),
WITHER(97, ABSTRACT_MONSTER),
RAVAGER(67, ABSTRACT_MONSTER),
ABSTRACT_PIGLIN(-1, ABSTRACT_MONSTER),
PIGLIN(60, ABSTRACT_PIGLIN),
PIGLIN_BRUTE(61, ABSTRACT_PIGLIN),
HOGLIN(32, ABSTRACT_ANIMAL),
STRIDER(83, ABSTRACT_ANIMAL),
ZOGLIN(101, ABSTRACT_MONSTER),
// Illagers
ABSTRACT_ILLAGER_BASE(-1, ABSTRACT_MONSTER),
ABSTRACT_EVO_ILLU_ILLAGER(-1, ABSTRACT_ILLAGER_BASE),
EVOKER(22, ABSTRACT_EVO_ILLU_ILLAGER),
ILLUSIONER(35, ABSTRACT_EVO_ILLU_ILLAGER),
VINDICATOR(94, ABSTRACT_ILLAGER_BASE),
PILLAGER(62, ABSTRACT_ILLAGER_BASE),
// Skeletons
ABSTRACT_SKELETON(-1, ABSTRACT_MONSTER),
SKELETON(73, ABSTRACT_SKELETON),
STRAY(82, ABSTRACT_SKELETON),
WITHER_SKELETON(98, ABSTRACT_SKELETON),
// Guardians
GUARDIAN(31, ABSTRACT_MONSTER),
ELDER_GUARDIAN(17, GUARDIAN),
// Spiders
SPIDER(80, ABSTRACT_MONSTER),
CAVE_SPIDER(8, SPIDER),
// Zombies
ZOMBIE(102, ABSTRACT_MONSTER),
DROWNED(16, ZOMBIE),
HUSK(34, ZOMBIE),
ZOMBIFIED_PIGLIN(105, ZOMBIE),
ZOMBIE_VILLAGER(104, ZOMBIE),
// Flying entities
ABSTRACT_FLYING(-1, ABSTRACT_INSENTIENT),
GHAST(29, ABSTRACT_FLYING),
PHANTOM(58, ABSTRACT_FLYING),
ABSTRACT_AMBIENT(-1, ABSTRACT_INSENTIENT),
BAT(3, ABSTRACT_AMBIENT),
ABSTRACT_WATERMOB(-1, ABSTRACT_INSENTIENT),
SQUID(81, ABSTRACT_WATERMOB),
// Slimes
SLIME(75, ABSTRACT_INSENTIENT),
MAGMA_CUBE(44, SLIME),
// Hangable objects
ABSTRACT_HANGING(-1, ENTITY),
LEASH_KNOT(40, ABSTRACT_HANGING),
ITEM_FRAME(38, ABSTRACT_HANGING),
PAINTING(55, ABSTRACT_HANGING),
ABSTRACT_LIGHTNING(-1, ENTITY),
LIGHTNING_BOLT(41, ABSTRACT_LIGHTNING),
// Arrows
ABSTRACT_ARROW(-1, ENTITY),
ARROW(2, ABSTRACT_ARROW),
SPECTRAL_ARROW(79, ABSTRACT_ARROW),
TRIDENT(88, ABSTRACT_ARROW),
// Fireballs
ABSTRACT_FIREBALL(-1, ENTITY),
DRAGON_FIREBALL(15, ABSTRACT_FIREBALL),
FIREBALL(39, ABSTRACT_FIREBALL),
SMALL_FIREBALL(76, ABSTRACT_FIREBALL),
WITHER_SKULL(99, ABSTRACT_FIREBALL),
// Projectiles // Projectiles
PROJECTILE_ABSTRACT(-1, ENTITY), PROJECTILE_ABSTRACT(ENTITY, null), // Not actually its own abstract type, but useful for categorizing
SNOWBALL(78, PROJECTILE_ABSTRACT), SNOWBALL(PROJECTILE_ABSTRACT),
ENDER_PEARL(85, PROJECTILE_ABSTRACT), ENDER_PEARL(PROJECTILE_ABSTRACT),
EGG(84, PROJECTILE_ABSTRACT), EGG(PROJECTILE_ABSTRACT),
POTION(87, PROJECTILE_ABSTRACT), POTION(PROJECTILE_ABSTRACT),
EXPERIENCE_BOTTLE(86, PROJECTILE_ABSTRACT), EXPERIENCE_BOTTLE(PROJECTILE_ABSTRACT),
FIREWORK_ROCKET(PROJECTILE_ABSTRACT),
LLAMA_SPIT(PROJECTILE_ABSTRACT),
SHULKER_BULLET(PROJECTILE_ABSTRACT),
FISHING_BOBBER(PROJECTILE_ABSTRACT),
WITHER_SKULL(PROJECTILE_ABSTRACT),
DRAGON_FIREBALL(PROJECTILE_ABSTRACT), // Doesn't actually inherit fireball
ABSTRACT_ARROW(PROJECTILE_ABSTRACT, null),
ARROW(ABSTRACT_ARROW),
SPECTRAL_ARROW(ABSTRACT_ARROW),
TRIDENT(ABSTRACT_ARROW),
ABSTRACT_FIREBALL(ENTITY, null),
FIREBALL(ABSTRACT_FIREBALL),
SMALL_FIREBALL(ABSTRACT_FIREBALL),
// Vehicles // Vehicles
MINECART_ABSTRACT(-1, ENTITY), VEHICLE(ENTITY, null),
CHESTED_MINECART_ABSTRACT(-1, MINECART_ABSTRACT), BOAT(VEHICLE),
CHEST_MINECART(46, CHESTED_MINECART_ABSTRACT),
HOPPER_MINECART(49, CHESTED_MINECART_ABSTRACT),
MINECART(45, MINECART_ABSTRACT),
FURNACE_MINECART(48, MINECART_ABSTRACT),
COMMAND_BLOCK_MINECART(47, MINECART_ABSTRACT),
TNT_MINECART(51, MINECART_ABSTRACT),
SPAWNER_MINECART(50, MINECART_ABSTRACT),
BOAT(6, ENTITY);
private static final EntityType[] TYPES; MINECART_ABSTRACT(VEHICLE, null),
MINECART(MINECART_ABSTRACT),
FURNACE_MINECART(MINECART_ABSTRACT),
COMMAND_BLOCK_MINECART(MINECART_ABSTRACT),
TNT_MINECART(MINECART_ABSTRACT),
SPAWNER_MINECART(MINECART_ABSTRACT),
private final int id; CHESTED_MINECART_ABSTRACT(MINECART_ABSTRACT, null),
CHEST_MINECART(CHESTED_MINECART_ABSTRACT),
HOPPER_MINECART(CHESTED_MINECART_ABSTRACT),
// Living entities as a larger subclass
LIVINGENTITY(ENTITY, null),
ARMOR_STAND(LIVINGENTITY),
PLAYER(LIVINGENTITY),
// Mobs as a larger subclass
ABSTRACT_INSENTIENT(LIVINGENTITY, null),
ENDER_DRAGON(ABSTRACT_INSENTIENT),
SLIME(ABSTRACT_INSENTIENT),
MAGMA_CUBE(SLIME),
// Ambient mobs
ABSTRACT_AMBIENT(ABSTRACT_INSENTIENT, null),
BAT(ABSTRACT_AMBIENT),
// Flying mobs
ABSTRACT_FLYING(ABSTRACT_INSENTIENT, null),
GHAST(ABSTRACT_FLYING),
PHANTOM(ABSTRACT_FLYING),
// Pathfinder mobs and its subclasses
ABSTRACT_CREATURE(ABSTRACT_INSENTIENT, null),
ABSTRACT_GOLEM(ABSTRACT_CREATURE, null),
SNOW_GOLEM(ABSTRACT_GOLEM),
IRON_GOLEM(ABSTRACT_GOLEM),
SHULKER(ABSTRACT_GOLEM),
// Water mobs
ABSTRACT_WATERMOB(ABSTRACT_CREATURE, null),
DOLPHIN(ABSTRACT_WATERMOB),
SQUID(ABSTRACT_WATERMOB),
ABSTRACT_FISHES(ABSTRACT_WATERMOB, null),
PUFFERFISH(ABSTRACT_FISHES),
ABSTRACT_SCHOOLING_FISH(ABSTRACT_FISHES, null),
COD(ABSTRACT_SCHOOLING_FISH),
SALMON(ABSTRACT_SCHOOLING_FISH),
TROPICAL_FISH(ABSTRACT_SCHOOLING_FISH),
// Ageable mobs and (tamable) animals
ABSTRACT_AGEABLE(ABSTRACT_CREATURE, null),
ABSTRACT_VILLAGER(ABSTRACT_AGEABLE, null),
VILLAGER(ABSTRACT_VILLAGER),
WANDERING_TRADER(ABSTRACT_VILLAGER),
ABSTRACT_ANIMAL(ABSTRACT_AGEABLE, null),
CHICKEN(ABSTRACT_ANIMAL),
PANDA(ABSTRACT_ANIMAL),
PIG(ABSTRACT_ANIMAL),
POLAR_BEAR(ABSTRACT_ANIMAL),
RABBIT(ABSTRACT_ANIMAL),
SHEEP(ABSTRACT_ANIMAL),
BEE(ABSTRACT_ANIMAL),
TURTLE(ABSTRACT_ANIMAL),
FOX(ABSTRACT_ANIMAL),
HOGLIN(ABSTRACT_ANIMAL),
STRIDER(ABSTRACT_ANIMAL),
COW(ABSTRACT_ANIMAL),
MOOSHROOM(COW),
ABSTRACT_TAMEABLE_ANIMAL(ABSTRACT_ANIMAL, null),
CAT(ABSTRACT_TAMEABLE_ANIMAL),
OCELOT(ABSTRACT_TAMEABLE_ANIMAL),
WOLF(ABSTRACT_TAMEABLE_ANIMAL),
PARROT(ABSTRACT_TAMEABLE_ANIMAL),
ABSTRACT_HORSE(ABSTRACT_ANIMAL, null),
HORSE(ABSTRACT_HORSE),
SKELETON_HORSE(ABSTRACT_HORSE),
ZOMBIE_HORSE(ABSTRACT_HORSE),
CHESTED_HORSE(ABSTRACT_HORSE, null),
DONKEY(CHESTED_HORSE),
MULE(CHESTED_HORSE),
LLAMA(CHESTED_HORSE),
TRADER_LLAMA(LLAMA),
// Monsters
ABSTRACT_MONSTER(ABSTRACT_CREATURE, null),
BLAZE(ABSTRACT_MONSTER),
CREEPER(ABSTRACT_MONSTER),
ENDERMITE(ABSTRACT_MONSTER),
ENDERMAN(ABSTRACT_MONSTER),
GIANT(ABSTRACT_MONSTER),
SILVERFISH(ABSTRACT_MONSTER),
VEX(ABSTRACT_MONSTER),
WITHER(ABSTRACT_MONSTER),
ZOGLIN(ABSTRACT_MONSTER),
ABSTRACT_SKELETON(ABSTRACT_MONSTER, null),
SKELETON(ABSTRACT_SKELETON),
STRAY(ABSTRACT_SKELETON),
WITHER_SKELETON(ABSTRACT_SKELETON),
ZOMBIE(ABSTRACT_MONSTER),
DROWNED(ZOMBIE),
HUSK(ZOMBIE),
ZOMBIFIED_PIGLIN(ZOMBIE),
ZOMBIE_VILLAGER(ZOMBIE),
GUARDIAN(ABSTRACT_MONSTER),
ELDER_GUARDIAN(GUARDIAN),
SPIDER(ABSTRACT_MONSTER),
CAVE_SPIDER(SPIDER),
ABSTRACT_PIGLIN(ABSTRACT_MONSTER, null),
PIGLIN(ABSTRACT_PIGLIN),
PIGLIN_BRUTE(ABSTRACT_PIGLIN),
// Raiders
ABSTRACT_RAIDER(ABSTRACT_MONSTER, null),
WITCH(ABSTRACT_RAIDER),
RAVAGER(ABSTRACT_RAIDER),
ABSTRACT_ILLAGER_BASE(ABSTRACT_RAIDER, null),
ABSTRACT_EVO_ILLU_ILLAGER(ABSTRACT_ILLAGER_BASE, null),
VINDICATOR(ABSTRACT_ILLAGER_BASE),
PILLAGER(ABSTRACT_ILLAGER_BASE),
EVOKER(ABSTRACT_EVO_ILLU_ILLAGER),
ILLUSIONER(ABSTRACT_EVO_ILLU_ILLAGER);
private static final EntityType[] TYPES = EntityTypeUtil.createSizedArray(values());
private final EntityType parent; private final EntityType parent;
private final String identifier;
private int id = -1;
EntityTypes1_16_2(int id) { EntityTypes1_16_2(final EntityType parent) {
this.id = id; this.parent = parent;
this.parent = null; this.identifier = "minecraft:" + name().toLowerCase(Locale.ROOT);
} }
EntityTypes1_16_2(int id, EntityType parent) { EntityTypes1_16_2(final EntityType parent, @Nullable final String identifier) {
this.id = id;
this.parent = parent; this.parent = parent;
this.identifier = identifier;
} }
@Override @Override
public int getId() { public int getId() {
if (id == -1) {
throw new IllegalStateException("Ids have not been initialized yet (type " + name() + ")");
}
return id; return id;
} }
@Override @Override
public EntityType getParent() { public String identifier() {
Preconditions.checkArgument(identifier != null, "Called identifier method on abstract type");
return identifier;
}
@Override
public @Nullable EntityType getParent() {
return parent; return parent;
} }
@Override
public String identifier() {
throw new UnsupportedOperationException();
}
@Override @Override
public boolean isAbstractType() { public boolean isAbstractType() {
return id != -1; return identifier == null;
} }
static { public static EntityType getTypeFromId(final int typeId) {
TYPES = EntityTypeUtil.toOrderedArray(values());
}
public static EntityType getTypeFromId(int typeId) {
return EntityTypeUtil.getTypeFromId(TYPES, typeId, ENTITY); return EntityTypeUtil.getTypeFromId(TYPES, typeId, ENTITY);
} }
public static void initialize(final Protocol<?, ?, ?, ?> protocol) {
EntityTypeUtil.initialize(values(), TYPES, protocol, (type, id) -> type.id = id);
}
} }

Datei anzeigen

@ -22,239 +22,246 @@
*/ */
package com.viaversion.viaversion.api.minecraft.entities; package com.viaversion.viaversion.api.minecraft.entities;
import com.google.common.base.Preconditions;
import com.viaversion.viaversion.api.protocol.Protocol;
import com.viaversion.viaversion.util.EntityTypeUtil; import com.viaversion.viaversion.util.EntityTypeUtil;
import java.util.Locale;
import org.checkerframework.checker.nullness.qual.Nullable;
public enum EntityTypes1_17 implements EntityType { public enum EntityTypes1_17 implements EntityType {
ENTITY(-1), ENTITY(null, null),
AREA_EFFECT_CLOUD(0, ENTITY), AREA_EFFECT_CLOUD(ENTITY),
END_CRYSTAL(19, ENTITY), END_CRYSTAL(ENTITY),
EVOKER_FANGS(24, ENTITY), EVOKER_FANGS(ENTITY),
EXPERIENCE_ORB(25, ENTITY), EXPERIENCE_ORB(ENTITY),
EYE_OF_ENDER(26, ENTITY), EYE_OF_ENDER(ENTITY),
FALLING_BLOCK(27, ENTITY), FALLING_BLOCK(ENTITY),
FIREWORK_ROCKET(28, ENTITY), ITEM(ENTITY),
ITEM(41, ENTITY), TNT(ENTITY),
LLAMA_SPIT(47, ENTITY), MARKER(ENTITY),
TNT(69, ENTITY), LIGHTNING_BOLT(ENTITY),
SHULKER_BULLET(76, ENTITY),
FISHING_BOBBER(112, ENTITY),
LIVINGENTITY(-1, ENTITY), // Hanging entities
ARMOR_STAND(1, LIVINGENTITY), ABSTRACT_HANGING(ENTITY, null),
MARKER(49, ENTITY), LEASH_KNOT(ABSTRACT_HANGING),
PLAYER(111, LIVINGENTITY), PAINTING(ABSTRACT_HANGING),
ITEM_FRAME(ABSTRACT_HANGING),
ABSTRACT_INSENTIENT(-1, LIVINGENTITY), GLOW_ITEM_FRAME(ITEM_FRAME),
ENDER_DRAGON(20, ABSTRACT_INSENTIENT),
BEE(5, ABSTRACT_INSENTIENT),
ABSTRACT_CREATURE(-1, ABSTRACT_INSENTIENT),
ABSTRACT_AGEABLE(-1, ABSTRACT_CREATURE),
VILLAGER(98, ABSTRACT_AGEABLE),
WANDERING_TRADER(100, ABSTRACT_AGEABLE),
// Animals
ABSTRACT_ANIMAL(-1, ABSTRACT_AGEABLE),
AXOLOTL(3, ABSTRACT_ANIMAL),
DOLPHIN(14, ABSTRACT_INSENTIENT),
CHICKEN(10, ABSTRACT_ANIMAL),
COW(12, ABSTRACT_ANIMAL),
MOOSHROOM(58, COW),
PANDA(61, ABSTRACT_INSENTIENT),
PIG(64, ABSTRACT_ANIMAL),
POLAR_BEAR(68, ABSTRACT_ANIMAL),
RABBIT(71, ABSTRACT_ANIMAL),
SHEEP(74, ABSTRACT_ANIMAL),
TURTLE(96, ABSTRACT_ANIMAL),
FOX(29, ABSTRACT_ANIMAL),
GOAT(34, ABSTRACT_ANIMAL),
ABSTRACT_TAMEABLE_ANIMAL(-1, ABSTRACT_ANIMAL),
CAT(8, ABSTRACT_TAMEABLE_ANIMAL),
OCELOT(59, ABSTRACT_TAMEABLE_ANIMAL),
WOLF(105, ABSTRACT_TAMEABLE_ANIMAL),
ABSTRACT_PARROT(-1, ABSTRACT_TAMEABLE_ANIMAL),
PARROT(62, ABSTRACT_PARROT),
// Horses
ABSTRACT_HORSE(-1, ABSTRACT_ANIMAL),
CHESTED_HORSE(-1, ABSTRACT_HORSE),
DONKEY(15, CHESTED_HORSE),
MULE(57, CHESTED_HORSE),
LLAMA(46, CHESTED_HORSE),
TRADER_LLAMA(94, CHESTED_HORSE),
HORSE(37, ABSTRACT_HORSE),
SKELETON_HORSE(79, ABSTRACT_HORSE),
ZOMBIE_HORSE(108, ABSTRACT_HORSE),
// Golem
ABSTRACT_GOLEM(-1, ABSTRACT_CREATURE),
SNOW_GOLEM(82, ABSTRACT_GOLEM),
IRON_GOLEM(40, ABSTRACT_GOLEM),
SHULKER(75, ABSTRACT_GOLEM),
// Fish
ABSTRACT_FISHES(-1, ABSTRACT_CREATURE),
COD(11, ABSTRACT_FISHES),
PUFFERFISH(70, ABSTRACT_FISHES),
SALMON(73, ABSTRACT_FISHES),
TROPICAL_FISH(95, ABSTRACT_FISHES),
// Monsters
ABSTRACT_MONSTER(-1, ABSTRACT_CREATURE),
BLAZE(6, ABSTRACT_MONSTER),
CREEPER(13, ABSTRACT_MONSTER),
ENDERMITE(22, ABSTRACT_MONSTER),
ENDERMAN(21, ABSTRACT_MONSTER),
GIANT(31, ABSTRACT_MONSTER),
SILVERFISH(77, ABSTRACT_MONSTER),
VEX(97, ABSTRACT_MONSTER),
WITCH(101, ABSTRACT_MONSTER),
WITHER(102, ABSTRACT_MONSTER),
RAVAGER(72, ABSTRACT_MONSTER),
ABSTRACT_PIGLIN(-1, ABSTRACT_MONSTER),
PIGLIN(65, ABSTRACT_PIGLIN),
PIGLIN_BRUTE(66, ABSTRACT_PIGLIN),
HOGLIN(36, ABSTRACT_ANIMAL),
STRIDER(88, ABSTRACT_ANIMAL),
ZOGLIN(106, ABSTRACT_MONSTER),
// Illagers
ABSTRACT_ILLAGER_BASE(-1, ABSTRACT_MONSTER),
ABSTRACT_EVO_ILLU_ILLAGER(-1, ABSTRACT_ILLAGER_BASE),
EVOKER(23, ABSTRACT_EVO_ILLU_ILLAGER),
ILLUSIONER(39, ABSTRACT_EVO_ILLU_ILLAGER),
VINDICATOR(99, ABSTRACT_ILLAGER_BASE),
PILLAGER(67, ABSTRACT_ILLAGER_BASE),
// Skeletons
ABSTRACT_SKELETON(-1, ABSTRACT_MONSTER),
SKELETON(78, ABSTRACT_SKELETON),
STRAY(87, ABSTRACT_SKELETON),
WITHER_SKELETON(103, ABSTRACT_SKELETON),
// Guardians
GUARDIAN(35, ABSTRACT_MONSTER),
ELDER_GUARDIAN(18, GUARDIAN),
// Spiders
SPIDER(85, ABSTRACT_MONSTER),
CAVE_SPIDER(9, SPIDER),
// Zombies
ZOMBIE(107, ABSTRACT_MONSTER),
DROWNED(17, ZOMBIE),
HUSK(38, ZOMBIE),
ZOMBIFIED_PIGLIN(110, ZOMBIE),
ZOMBIE_VILLAGER(109, ZOMBIE),
// Flying entities
ABSTRACT_FLYING(-1, ABSTRACT_INSENTIENT),
GHAST(30, ABSTRACT_FLYING),
PHANTOM(63, ABSTRACT_FLYING),
ABSTRACT_AMBIENT(-1, ABSTRACT_INSENTIENT),
BAT(4, ABSTRACT_AMBIENT),
ABSTRACT_WATERMOB(-1, ABSTRACT_INSENTIENT),
SQUID(86, ABSTRACT_WATERMOB),
GLOW_SQUID(33, SQUID),
// Slimes
SLIME(80, ABSTRACT_INSENTIENT),
MAGMA_CUBE(48, SLIME),
// Hangable objects
ABSTRACT_HANGING(-1, ENTITY),
LEASH_KNOT(44, ABSTRACT_HANGING),
ITEM_FRAME(42, ABSTRACT_HANGING),
GLOW_ITEM_FRAME(32, ITEM_FRAME),
PAINTING(60, ABSTRACT_HANGING),
ABSTRACT_LIGHTNING(-1, ENTITY),
LIGHTNING_BOLT(45, ABSTRACT_LIGHTNING),
// Arrows
ABSTRACT_ARROW(-1, ENTITY),
ARROW(2, ABSTRACT_ARROW),
SPECTRAL_ARROW(84, ABSTRACT_ARROW),
TRIDENT(93, ABSTRACT_ARROW),
// Fireballs
ABSTRACT_FIREBALL(-1, ENTITY),
DRAGON_FIREBALL(16, ABSTRACT_FIREBALL),
FIREBALL(43, ABSTRACT_FIREBALL),
SMALL_FIREBALL(81, ABSTRACT_FIREBALL),
WITHER_SKULL(104, ABSTRACT_FIREBALL),
// Projectiles // Projectiles
PROJECTILE_ABSTRACT(-1, ENTITY), PROJECTILE_ABSTRACT(ENTITY, null), // Not actually its own abstract type, but useful for categorizing
SNOWBALL(83, PROJECTILE_ABSTRACT), SNOWBALL(PROJECTILE_ABSTRACT),
ENDER_PEARL(90, PROJECTILE_ABSTRACT), ENDER_PEARL(PROJECTILE_ABSTRACT),
EGG(89, PROJECTILE_ABSTRACT), EGG(PROJECTILE_ABSTRACT),
POTION(92, PROJECTILE_ABSTRACT), POTION(PROJECTILE_ABSTRACT),
EXPERIENCE_BOTTLE(91, PROJECTILE_ABSTRACT), EXPERIENCE_BOTTLE(PROJECTILE_ABSTRACT),
FIREWORK_ROCKET(PROJECTILE_ABSTRACT),
LLAMA_SPIT(PROJECTILE_ABSTRACT),
SHULKER_BULLET(PROJECTILE_ABSTRACT),
FISHING_BOBBER(PROJECTILE_ABSTRACT),
WITHER_SKULL(PROJECTILE_ABSTRACT),
DRAGON_FIREBALL(PROJECTILE_ABSTRACT), // Doesn't actually inherit fireball
ABSTRACT_ARROW(PROJECTILE_ABSTRACT, null),
ARROW(ABSTRACT_ARROW),
SPECTRAL_ARROW(ABSTRACT_ARROW),
TRIDENT(ABSTRACT_ARROW),
ABSTRACT_FIREBALL(ENTITY, null),
FIREBALL(ABSTRACT_FIREBALL),
SMALL_FIREBALL(ABSTRACT_FIREBALL),
// Vehicles // Vehicles
MINECART_ABSTRACT(-1, ENTITY), VEHICLE(ENTITY, null),
CHESTED_MINECART_ABSTRACT(-1, MINECART_ABSTRACT), BOAT(VEHICLE),
CHEST_MINECART(51, CHESTED_MINECART_ABSTRACT),
HOPPER_MINECART(54, CHESTED_MINECART_ABSTRACT),
MINECART(50, MINECART_ABSTRACT),
FURNACE_MINECART(53, MINECART_ABSTRACT),
COMMAND_BLOCK_MINECART(52, MINECART_ABSTRACT),
TNT_MINECART(56, MINECART_ABSTRACT),
SPAWNER_MINECART(55, MINECART_ABSTRACT),
BOAT(7, ENTITY);
private static final EntityType[] TYPES; MINECART_ABSTRACT(VEHICLE, null),
MINECART(MINECART_ABSTRACT),
FURNACE_MINECART(MINECART_ABSTRACT),
COMMAND_BLOCK_MINECART(MINECART_ABSTRACT),
TNT_MINECART(MINECART_ABSTRACT),
SPAWNER_MINECART(MINECART_ABSTRACT),
private final int id; CHESTED_MINECART_ABSTRACT(MINECART_ABSTRACT, null),
CHEST_MINECART(CHESTED_MINECART_ABSTRACT),
HOPPER_MINECART(CHESTED_MINECART_ABSTRACT),
// Living entities as a larger subclass
LIVINGENTITY(ENTITY, null),
ARMOR_STAND(LIVINGENTITY),
PLAYER(LIVINGENTITY),
// Mobs as a larger subclass
ABSTRACT_INSENTIENT(LIVINGENTITY, null),
ENDER_DRAGON(ABSTRACT_INSENTIENT),
SLIME(ABSTRACT_INSENTIENT),
MAGMA_CUBE(SLIME),
// Ambient mobs
ABSTRACT_AMBIENT(ABSTRACT_INSENTIENT, null),
BAT(ABSTRACT_AMBIENT),
// Flying mobs
ABSTRACT_FLYING(ABSTRACT_INSENTIENT, null),
GHAST(ABSTRACT_FLYING),
PHANTOM(ABSTRACT_FLYING),
// Pathfinder mobs and its subclasses
ABSTRACT_CREATURE(ABSTRACT_INSENTIENT, null),
ABSTRACT_GOLEM(ABSTRACT_CREATURE, null),
SNOW_GOLEM(ABSTRACT_GOLEM),
IRON_GOLEM(ABSTRACT_GOLEM),
SHULKER(ABSTRACT_GOLEM),
// Water mobs
ABSTRACT_WATERMOB(ABSTRACT_CREATURE, null),
DOLPHIN(ABSTRACT_WATERMOB),
SQUID(ABSTRACT_WATERMOB),
GLOW_SQUID(SQUID),
ABSTRACT_FISHES(ABSTRACT_WATERMOB, null),
PUFFERFISH(ABSTRACT_FISHES),
ABSTRACT_SCHOOLING_FISH(ABSTRACT_FISHES, null),
COD(ABSTRACT_SCHOOLING_FISH),
SALMON(ABSTRACT_SCHOOLING_FISH),
TROPICAL_FISH(ABSTRACT_SCHOOLING_FISH),
// Ageable mobs and (tamable) animals
ABSTRACT_AGEABLE(ABSTRACT_CREATURE, null),
ABSTRACT_VILLAGER(ABSTRACT_AGEABLE, null),
VILLAGER(ABSTRACT_VILLAGER),
WANDERING_TRADER(ABSTRACT_VILLAGER),
ABSTRACT_ANIMAL(ABSTRACT_AGEABLE, null),
AXOLOTL(ABSTRACT_ANIMAL),
CHICKEN(ABSTRACT_ANIMAL),
PANDA(ABSTRACT_ANIMAL),
PIG(ABSTRACT_ANIMAL),
POLAR_BEAR(ABSTRACT_ANIMAL),
RABBIT(ABSTRACT_ANIMAL),
SHEEP(ABSTRACT_ANIMAL),
BEE(ABSTRACT_ANIMAL),
TURTLE(ABSTRACT_ANIMAL),
FOX(ABSTRACT_ANIMAL),
GOAT(ABSTRACT_ANIMAL),
HOGLIN(ABSTRACT_ANIMAL),
STRIDER(ABSTRACT_ANIMAL),
COW(ABSTRACT_ANIMAL),
MOOSHROOM(COW),
ABSTRACT_TAMEABLE_ANIMAL(ABSTRACT_ANIMAL, null),
CAT(ABSTRACT_TAMEABLE_ANIMAL),
OCELOT(ABSTRACT_TAMEABLE_ANIMAL),
WOLF(ABSTRACT_TAMEABLE_ANIMAL),
PARROT(ABSTRACT_TAMEABLE_ANIMAL),
ABSTRACT_HORSE(ABSTRACT_ANIMAL, null),
HORSE(ABSTRACT_HORSE),
SKELETON_HORSE(ABSTRACT_HORSE),
ZOMBIE_HORSE(ABSTRACT_HORSE),
CHESTED_HORSE(ABSTRACT_HORSE, null),
DONKEY(CHESTED_HORSE),
MULE(CHESTED_HORSE),
LLAMA(CHESTED_HORSE),
TRADER_LLAMA(LLAMA),
// Monsters
ABSTRACT_MONSTER(ABSTRACT_CREATURE, null),
BLAZE(ABSTRACT_MONSTER),
CREEPER(ABSTRACT_MONSTER),
ENDERMITE(ABSTRACT_MONSTER),
ENDERMAN(ABSTRACT_MONSTER),
GIANT(ABSTRACT_MONSTER),
SILVERFISH(ABSTRACT_MONSTER),
VEX(ABSTRACT_MONSTER),
WITHER(ABSTRACT_MONSTER),
ZOGLIN(ABSTRACT_MONSTER),
ABSTRACT_SKELETON(ABSTRACT_MONSTER, null),
SKELETON(ABSTRACT_SKELETON),
STRAY(ABSTRACT_SKELETON),
WITHER_SKELETON(ABSTRACT_SKELETON),
ZOMBIE(ABSTRACT_MONSTER),
DROWNED(ZOMBIE),
HUSK(ZOMBIE),
ZOMBIFIED_PIGLIN(ZOMBIE),
ZOMBIE_VILLAGER(ZOMBIE),
GUARDIAN(ABSTRACT_MONSTER),
ELDER_GUARDIAN(GUARDIAN),
SPIDER(ABSTRACT_MONSTER),
CAVE_SPIDER(SPIDER),
ABSTRACT_PIGLIN(ABSTRACT_MONSTER, null),
PIGLIN(ABSTRACT_PIGLIN),
PIGLIN_BRUTE(ABSTRACT_PIGLIN),
// Raiders
ABSTRACT_RAIDER(ABSTRACT_MONSTER, null),
WITCH(ABSTRACT_RAIDER),
RAVAGER(ABSTRACT_RAIDER),
ABSTRACT_ILLAGER_BASE(ABSTRACT_RAIDER, null),
ABSTRACT_EVO_ILLU_ILLAGER(ABSTRACT_ILLAGER_BASE, null),
VINDICATOR(ABSTRACT_ILLAGER_BASE),
PILLAGER(ABSTRACT_ILLAGER_BASE),
EVOKER(ABSTRACT_EVO_ILLU_ILLAGER),
ILLUSIONER(ABSTRACT_EVO_ILLU_ILLAGER);
private static final EntityType[] TYPES = EntityTypeUtil.createSizedArray(values());
private final EntityType parent; private final EntityType parent;
private final String identifier;
private int id = -1;
EntityTypes1_17(int id) { EntityTypes1_17(final EntityType parent) {
this.id = id; this.parent = parent;
this.parent = null; this.identifier = "minecraft:" + name().toLowerCase(Locale.ROOT);
} }
EntityTypes1_17(int id, EntityType parent) { EntityTypes1_17(final EntityType parent, @Nullable final String identifier) {
this.id = id;
this.parent = parent; this.parent = parent;
this.identifier = identifier;
} }
@Override @Override
public int getId() { public int getId() {
if (id == -1) {
throw new IllegalStateException("Ids have not been initialized yet (type " + name() + ")");
}
return id; return id;
} }
@Override @Override
public EntityType getParent() { public String identifier() {
Preconditions.checkArgument(identifier != null, "Called identifier method on abstract type");
return identifier;
}
@Override
public @Nullable EntityType getParent() {
return parent; return parent;
} }
@Override
public String identifier() {
throw new UnsupportedOperationException();
}
@Override @Override
public boolean isAbstractType() { public boolean isAbstractType() {
return id != -1; return identifier == null;
} }
static { public static EntityType getTypeFromId(final int typeId) {
TYPES = EntityTypeUtil.toOrderedArray(values());
}
public static EntityType getTypeFromId(int typeId) {
return EntityTypeUtil.getTypeFromId(TYPES, typeId, ENTITY); return EntityTypeUtil.getTypeFromId(TYPES, typeId, ENTITY);
} }
public static void initialize(final Protocol<?, ?, ?, ?> protocol) {
EntityTypeUtil.initialize(values(), TYPES, protocol, (type, id) -> type.id = id);
}
} }

Datei anzeigen

@ -38,77 +38,144 @@ public enum EntityTypes1_19 implements EntityType {
EXPERIENCE_ORB(ENTITY), EXPERIENCE_ORB(ENTITY),
EYE_OF_ENDER(ENTITY), EYE_OF_ENDER(ENTITY),
FALLING_BLOCK(ENTITY), FALLING_BLOCK(ENTITY),
FIREWORK_ROCKET(ENTITY),
ITEM(ENTITY), ITEM(ENTITY),
LLAMA_SPIT(ENTITY),
TNT(ENTITY), TNT(ENTITY),
SHULKER_BULLET(ENTITY), MARKER(ENTITY),
FISHING_BOBBER(ENTITY), LIGHTNING_BOLT(ENTITY),
// Hanging entities
ABSTRACT_HANGING(ENTITY, null),
LEASH_KNOT(ABSTRACT_HANGING),
PAINTING(ABSTRACT_HANGING),
ITEM_FRAME(ABSTRACT_HANGING),
GLOW_ITEM_FRAME(ITEM_FRAME),
// Projectiles
PROJECTILE_ABSTRACT(ENTITY, null), // Not actually its own abstract type, but useful for categorizing
SNOWBALL(PROJECTILE_ABSTRACT),
ENDER_PEARL(PROJECTILE_ABSTRACT),
EGG(PROJECTILE_ABSTRACT),
POTION(PROJECTILE_ABSTRACT),
EXPERIENCE_BOTTLE(PROJECTILE_ABSTRACT),
FIREWORK_ROCKET(PROJECTILE_ABSTRACT),
LLAMA_SPIT(PROJECTILE_ABSTRACT),
SHULKER_BULLET(PROJECTILE_ABSTRACT),
FISHING_BOBBER(PROJECTILE_ABSTRACT),
WITHER_SKULL(PROJECTILE_ABSTRACT),
DRAGON_FIREBALL(PROJECTILE_ABSTRACT), // Doesn't actually inherit fireball
ABSTRACT_ARROW(PROJECTILE_ABSTRACT, null),
ARROW(ABSTRACT_ARROW),
SPECTRAL_ARROW(ABSTRACT_ARROW),
TRIDENT(ABSTRACT_ARROW),
ABSTRACT_FIREBALL(ENTITY, null),
FIREBALL(ABSTRACT_FIREBALL),
SMALL_FIREBALL(ABSTRACT_FIREBALL),
// Vehicles
VEHICLE(ENTITY, null),
BOAT(VEHICLE),
MINECART_ABSTRACT(VEHICLE, null),
MINECART(MINECART_ABSTRACT),
FURNACE_MINECART(MINECART_ABSTRACT),
COMMAND_BLOCK_MINECART(MINECART_ABSTRACT),
TNT_MINECART(MINECART_ABSTRACT),
SPAWNER_MINECART(MINECART_ABSTRACT),
CHEST_BOAT(BOAT),
CHESTED_MINECART_ABSTRACT(MINECART_ABSTRACT, null),
CHEST_MINECART(CHESTED_MINECART_ABSTRACT),
HOPPER_MINECART(CHESTED_MINECART_ABSTRACT),
// Living entities as a larger subclass
LIVINGENTITY(ENTITY, null), LIVINGENTITY(ENTITY, null),
ARMOR_STAND(LIVINGENTITY), ARMOR_STAND(LIVINGENTITY),
MARKER(ENTITY),
PLAYER(LIVINGENTITY), PLAYER(LIVINGENTITY),
// Mobs as a larger subclass
ABSTRACT_INSENTIENT(LIVINGENTITY, null), ABSTRACT_INSENTIENT(LIVINGENTITY, null),
ENDER_DRAGON(ABSTRACT_INSENTIENT), ENDER_DRAGON(ABSTRACT_INSENTIENT),
BEE(ABSTRACT_INSENTIENT), SLIME(ABSTRACT_INSENTIENT),
MAGMA_CUBE(SLIME),
// Ambient mobs
ABSTRACT_AMBIENT(ABSTRACT_INSENTIENT, null),
BAT(ABSTRACT_AMBIENT),
// Flying mobs
ABSTRACT_FLYING(ABSTRACT_INSENTIENT, null),
GHAST(ABSTRACT_FLYING),
PHANTOM(ABSTRACT_FLYING),
// Pathfinder mobs and its subclasses
ABSTRACT_CREATURE(ABSTRACT_INSENTIENT, null), ABSTRACT_CREATURE(ABSTRACT_INSENTIENT, null),
ALLAY(ABSTRACT_CREATURE),
ABSTRACT_AGEABLE(ABSTRACT_CREATURE, null),
VILLAGER(ABSTRACT_AGEABLE),
WANDERING_TRADER(ABSTRACT_AGEABLE),
// Animals
ABSTRACT_ANIMAL(ABSTRACT_AGEABLE, null),
AXOLOTL(ABSTRACT_ANIMAL),
DOLPHIN(ABSTRACT_INSENTIENT),
CHICKEN(ABSTRACT_ANIMAL),
COW(ABSTRACT_ANIMAL),
MOOSHROOM(COW),
PANDA(ABSTRACT_INSENTIENT),
PIG(ABSTRACT_ANIMAL),
POLAR_BEAR(ABSTRACT_ANIMAL),
RABBIT(ABSTRACT_ANIMAL),
SHEEP(ABSTRACT_ANIMAL),
TURTLE(ABSTRACT_ANIMAL),
FOX(ABSTRACT_ANIMAL),
FROG(ABSTRACT_ANIMAL),
GOAT(ABSTRACT_ANIMAL),
ABSTRACT_TAMEABLE_ANIMAL(ABSTRACT_ANIMAL, null),
CAT(ABSTRACT_TAMEABLE_ANIMAL),
OCELOT(ABSTRACT_TAMEABLE_ANIMAL),
WOLF(ABSTRACT_TAMEABLE_ANIMAL),
ABSTRACT_PARROT(ABSTRACT_TAMEABLE_ANIMAL, null),
PARROT(ABSTRACT_PARROT),
// Horses
ABSTRACT_HORSE(ABSTRACT_ANIMAL, null),
CHESTED_HORSE(ABSTRACT_HORSE, null),
DONKEY(CHESTED_HORSE),
MULE(CHESTED_HORSE),
LLAMA(CHESTED_HORSE),
TRADER_LLAMA(CHESTED_HORSE),
HORSE(ABSTRACT_HORSE),
SKELETON_HORSE(ABSTRACT_HORSE),
ZOMBIE_HORSE(ABSTRACT_HORSE),
// Golem
ABSTRACT_GOLEM(ABSTRACT_CREATURE, null), ABSTRACT_GOLEM(ABSTRACT_CREATURE, null),
SNOW_GOLEM(ABSTRACT_GOLEM), SNOW_GOLEM(ABSTRACT_GOLEM),
IRON_GOLEM(ABSTRACT_GOLEM), IRON_GOLEM(ABSTRACT_GOLEM),
SHULKER(ABSTRACT_GOLEM), SHULKER(ABSTRACT_GOLEM),
// Fish // Water mobs
ABSTRACT_FISHES(ABSTRACT_CREATURE, null), ABSTRACT_WATERMOB(ABSTRACT_CREATURE, null),
COD(ABSTRACT_FISHES), DOLPHIN(ABSTRACT_WATERMOB),
SQUID(ABSTRACT_WATERMOB),
GLOW_SQUID(SQUID),
ABSTRACT_FISHES(ABSTRACT_WATERMOB, null),
PUFFERFISH(ABSTRACT_FISHES), PUFFERFISH(ABSTRACT_FISHES),
SALMON(ABSTRACT_FISHES), TADPOLE(ABSTRACT_FISHES),
TROPICAL_FISH(ABSTRACT_FISHES),
ABSTRACT_SCHOOLING_FISH(ABSTRACT_FISHES, null),
COD(ABSTRACT_SCHOOLING_FISH),
SALMON(ABSTRACT_SCHOOLING_FISH),
TROPICAL_FISH(ABSTRACT_SCHOOLING_FISH),
// Ageable mobs and (tamable) animals
ABSTRACT_AGEABLE(ABSTRACT_CREATURE, null),
ABSTRACT_VILLAGER(ABSTRACT_AGEABLE, null),
VILLAGER(ABSTRACT_VILLAGER),
WANDERING_TRADER(ABSTRACT_VILLAGER),
ABSTRACT_ANIMAL(ABSTRACT_AGEABLE, null),
AXOLOTL(ABSTRACT_ANIMAL),
CHICKEN(ABSTRACT_ANIMAL),
PANDA(ABSTRACT_ANIMAL),
PIG(ABSTRACT_ANIMAL),
POLAR_BEAR(ABSTRACT_ANIMAL),
RABBIT(ABSTRACT_ANIMAL),
SHEEP(ABSTRACT_ANIMAL),
BEE(ABSTRACT_ANIMAL),
TURTLE(ABSTRACT_ANIMAL),
FOX(ABSTRACT_ANIMAL),
FROG(ABSTRACT_ANIMAL),
GOAT(ABSTRACT_ANIMAL),
HOGLIN(ABSTRACT_ANIMAL),
STRIDER(ABSTRACT_ANIMAL),
COW(ABSTRACT_ANIMAL),
MOOSHROOM(COW),
ABSTRACT_TAMEABLE_ANIMAL(ABSTRACT_ANIMAL, null),
CAT(ABSTRACT_TAMEABLE_ANIMAL),
OCELOT(ABSTRACT_TAMEABLE_ANIMAL),
WOLF(ABSTRACT_TAMEABLE_ANIMAL),
PARROT(ABSTRACT_TAMEABLE_ANIMAL),
ABSTRACT_HORSE(ABSTRACT_ANIMAL, null),
HORSE(ABSTRACT_HORSE),
SKELETON_HORSE(ABSTRACT_HORSE),
ZOMBIE_HORSE(ABSTRACT_HORSE),
CHESTED_HORSE(ABSTRACT_HORSE, null),
DONKEY(CHESTED_HORSE),
MULE(CHESTED_HORSE),
LLAMA(CHESTED_HORSE),
TRADER_LLAMA(LLAMA),
// Monsters // Monsters
ABSTRACT_MONSTER(ABSTRACT_CREATURE, null), ABSTRACT_MONSTER(ABSTRACT_CREATURE, null),
@ -119,110 +186,42 @@ public enum EntityTypes1_19 implements EntityType {
GIANT(ABSTRACT_MONSTER), GIANT(ABSTRACT_MONSTER),
SILVERFISH(ABSTRACT_MONSTER), SILVERFISH(ABSTRACT_MONSTER),
VEX(ABSTRACT_MONSTER), VEX(ABSTRACT_MONSTER),
WITCH(ABSTRACT_MONSTER),
WITHER(ABSTRACT_MONSTER), WITHER(ABSTRACT_MONSTER),
RAVAGER(ABSTRACT_MONSTER),
ABSTRACT_PIGLIN(ABSTRACT_MONSTER, null),
PIGLIN(ABSTRACT_PIGLIN),
PIGLIN_BRUTE(ABSTRACT_PIGLIN),
HOGLIN(ABSTRACT_ANIMAL),
STRIDER(ABSTRACT_ANIMAL),
TADPOLE(ABSTRACT_FISHES),
ZOGLIN(ABSTRACT_MONSTER), ZOGLIN(ABSTRACT_MONSTER),
WARDEN(ABSTRACT_MONSTER), WARDEN(ABSTRACT_MONSTER),
// Illagers
ABSTRACT_ILLAGER_BASE(ABSTRACT_MONSTER, null),
ABSTRACT_EVO_ILLU_ILLAGER(ABSTRACT_ILLAGER_BASE, null),
EVOKER(ABSTRACT_EVO_ILLU_ILLAGER),
ILLUSIONER(ABSTRACT_EVO_ILLU_ILLAGER),
VINDICATOR(ABSTRACT_ILLAGER_BASE),
PILLAGER(ABSTRACT_ILLAGER_BASE),
// Skeletons
ABSTRACT_SKELETON(ABSTRACT_MONSTER, null), ABSTRACT_SKELETON(ABSTRACT_MONSTER, null),
SKELETON(ABSTRACT_SKELETON), SKELETON(ABSTRACT_SKELETON),
STRAY(ABSTRACT_SKELETON), STRAY(ABSTRACT_SKELETON),
WITHER_SKELETON(ABSTRACT_SKELETON), WITHER_SKELETON(ABSTRACT_SKELETON),
// Guardians
GUARDIAN(ABSTRACT_MONSTER),
ELDER_GUARDIAN(GUARDIAN),
// Spiders
SPIDER(ABSTRACT_MONSTER),
CAVE_SPIDER(SPIDER),
// Zombies
ZOMBIE(ABSTRACT_MONSTER), ZOMBIE(ABSTRACT_MONSTER),
DROWNED(ZOMBIE), DROWNED(ZOMBIE),
HUSK(ZOMBIE), HUSK(ZOMBIE),
ZOMBIFIED_PIGLIN(ZOMBIE), ZOMBIFIED_PIGLIN(ZOMBIE),
ZOMBIE_VILLAGER(ZOMBIE), ZOMBIE_VILLAGER(ZOMBIE),
// Flying entities GUARDIAN(ABSTRACT_MONSTER),
ABSTRACT_FLYING(ABSTRACT_INSENTIENT, null), ELDER_GUARDIAN(GUARDIAN),
GHAST(ABSTRACT_FLYING),
PHANTOM(ABSTRACT_FLYING),
ABSTRACT_AMBIENT(ABSTRACT_INSENTIENT, null), SPIDER(ABSTRACT_MONSTER),
BAT(ABSTRACT_AMBIENT), CAVE_SPIDER(SPIDER),
ALLAY(ABSTRACT_CREATURE),
ABSTRACT_WATERMOB(ABSTRACT_INSENTIENT, null), ABSTRACT_PIGLIN(ABSTRACT_MONSTER, null),
SQUID(ABSTRACT_WATERMOB), PIGLIN(ABSTRACT_PIGLIN),
GLOW_SQUID(SQUID), PIGLIN_BRUTE(ABSTRACT_PIGLIN),
// Slimes // Raiders
SLIME(ABSTRACT_INSENTIENT), ABSTRACT_RAIDER(ABSTRACT_MONSTER, null),
MAGMA_CUBE(SLIME), WITCH(ABSTRACT_RAIDER),
RAVAGER(ABSTRACT_RAIDER),
// Hangable objects ABSTRACT_ILLAGER_BASE(ABSTRACT_RAIDER, null),
ABSTRACT_HANGING(ENTITY, null), ABSTRACT_EVO_ILLU_ILLAGER(ABSTRACT_ILLAGER_BASE, null),
LEASH_KNOT(ABSTRACT_HANGING), VINDICATOR(ABSTRACT_ILLAGER_BASE),
ITEM_FRAME(ABSTRACT_HANGING), PILLAGER(ABSTRACT_ILLAGER_BASE),
GLOW_ITEM_FRAME(ITEM_FRAME), EVOKER(ABSTRACT_EVO_ILLU_ILLAGER),
PAINTING(ABSTRACT_HANGING), ILLUSIONER(ABSTRACT_EVO_ILLU_ILLAGER);
ABSTRACT_LIGHTNING(ENTITY, null),
LIGHTNING_BOLT(ABSTRACT_LIGHTNING),
// Arrows
ABSTRACT_ARROW(ENTITY, null),
ARROW(ABSTRACT_ARROW),
SPECTRAL_ARROW(ABSTRACT_ARROW),
TRIDENT(ABSTRACT_ARROW),
// Fireballs
ABSTRACT_FIREBALL(ENTITY, null),
DRAGON_FIREBALL(ABSTRACT_FIREBALL),
FIREBALL(ABSTRACT_FIREBALL),
SMALL_FIREBALL(ABSTRACT_FIREBALL),
WITHER_SKULL(ABSTRACT_FIREBALL),
// Projectiles
PROJECTILE_ABSTRACT(ENTITY, null),
SNOWBALL(PROJECTILE_ABSTRACT),
ENDER_PEARL(PROJECTILE_ABSTRACT),
EGG(PROJECTILE_ABSTRACT),
POTION(PROJECTILE_ABSTRACT),
EXPERIENCE_BOTTLE(PROJECTILE_ABSTRACT),
// Vehicles
MINECART_ABSTRACT(ENTITY, null),
CHESTED_MINECART_ABSTRACT(MINECART_ABSTRACT, null),
CHEST_MINECART(CHESTED_MINECART_ABSTRACT),
HOPPER_MINECART(CHESTED_MINECART_ABSTRACT),
MINECART(MINECART_ABSTRACT),
FURNACE_MINECART(MINECART_ABSTRACT),
COMMAND_BLOCK_MINECART(MINECART_ABSTRACT),
TNT_MINECART(MINECART_ABSTRACT),
SPAWNER_MINECART(MINECART_ABSTRACT),
BOAT(ENTITY),
CHEST_BOAT(BOAT);
private static final EntityType[] TYPES = EntityTypeUtil.createSizedArray(values()); private static final EntityType[] TYPES = EntityTypeUtil.createSizedArray(values());
private final EntityType parent; private final EntityType parent;

Datei anzeigen

@ -38,78 +38,145 @@ public enum EntityTypes1_19_3 implements EntityType {
EXPERIENCE_ORB(ENTITY), EXPERIENCE_ORB(ENTITY),
EYE_OF_ENDER(ENTITY), EYE_OF_ENDER(ENTITY),
FALLING_BLOCK(ENTITY), FALLING_BLOCK(ENTITY),
FIREWORK_ROCKET(ENTITY),
ITEM(ENTITY), ITEM(ENTITY),
LLAMA_SPIT(ENTITY),
TNT(ENTITY), TNT(ENTITY),
SHULKER_BULLET(ENTITY), MARKER(ENTITY),
FISHING_BOBBER(ENTITY), LIGHTNING_BOLT(ENTITY),
// Hanging entities
ABSTRACT_HANGING(ENTITY, null),
LEASH_KNOT(ABSTRACT_HANGING),
PAINTING(ABSTRACT_HANGING),
ITEM_FRAME(ABSTRACT_HANGING),
GLOW_ITEM_FRAME(ITEM_FRAME),
// Projectiles
PROJECTILE_ABSTRACT(ENTITY, null), // Not actually its own abstract type, but useful for categorizing
SNOWBALL(PROJECTILE_ABSTRACT),
ENDER_PEARL(PROJECTILE_ABSTRACT),
EGG(PROJECTILE_ABSTRACT),
POTION(PROJECTILE_ABSTRACT),
EXPERIENCE_BOTTLE(PROJECTILE_ABSTRACT),
FIREWORK_ROCKET(PROJECTILE_ABSTRACT),
LLAMA_SPIT(PROJECTILE_ABSTRACT),
SHULKER_BULLET(PROJECTILE_ABSTRACT),
FISHING_BOBBER(PROJECTILE_ABSTRACT),
WITHER_SKULL(PROJECTILE_ABSTRACT),
DRAGON_FIREBALL(PROJECTILE_ABSTRACT), // Doesn't actually inherit fireball
ABSTRACT_ARROW(PROJECTILE_ABSTRACT, null),
ARROW(ABSTRACT_ARROW),
SPECTRAL_ARROW(ABSTRACT_ARROW),
TRIDENT(ABSTRACT_ARROW),
ABSTRACT_FIREBALL(ENTITY, null),
FIREBALL(ABSTRACT_FIREBALL),
SMALL_FIREBALL(ABSTRACT_FIREBALL),
// Vehicles
VEHICLE(ENTITY, null),
BOAT(VEHICLE),
MINECART_ABSTRACT(VEHICLE, null),
MINECART(MINECART_ABSTRACT),
FURNACE_MINECART(MINECART_ABSTRACT),
COMMAND_BLOCK_MINECART(MINECART_ABSTRACT),
TNT_MINECART(MINECART_ABSTRACT),
SPAWNER_MINECART(MINECART_ABSTRACT),
CHEST_BOAT(BOAT),
CHESTED_MINECART_ABSTRACT(MINECART_ABSTRACT, null),
CHEST_MINECART(CHESTED_MINECART_ABSTRACT),
HOPPER_MINECART(CHESTED_MINECART_ABSTRACT),
// Living entities as a larger subclass
LIVINGENTITY(ENTITY, null), LIVINGENTITY(ENTITY, null),
ARMOR_STAND(LIVINGENTITY), ARMOR_STAND(LIVINGENTITY),
MARKER(ENTITY),
PLAYER(LIVINGENTITY), PLAYER(LIVINGENTITY),
// Mobs as a larger subclass
ABSTRACT_INSENTIENT(LIVINGENTITY, null), ABSTRACT_INSENTIENT(LIVINGENTITY, null),
ENDER_DRAGON(ABSTRACT_INSENTIENT), ENDER_DRAGON(ABSTRACT_INSENTIENT),
BEE(ABSTRACT_INSENTIENT), SLIME(ABSTRACT_INSENTIENT),
MAGMA_CUBE(SLIME),
// Ambient mobs
ABSTRACT_AMBIENT(ABSTRACT_INSENTIENT, null),
BAT(ABSTRACT_AMBIENT),
// Flying mobs
ABSTRACT_FLYING(ABSTRACT_INSENTIENT, null),
GHAST(ABSTRACT_FLYING),
PHANTOM(ABSTRACT_FLYING),
// Pathfinder mobs and its subclasses
ABSTRACT_CREATURE(ABSTRACT_INSENTIENT, null), ABSTRACT_CREATURE(ABSTRACT_INSENTIENT, null),
ALLAY(ABSTRACT_CREATURE),
ABSTRACT_AGEABLE(ABSTRACT_CREATURE, null),
VILLAGER(ABSTRACT_AGEABLE),
WANDERING_TRADER(ABSTRACT_AGEABLE),
// Animals
ABSTRACT_ANIMAL(ABSTRACT_AGEABLE, null),
AXOLOTL(ABSTRACT_ANIMAL),
DOLPHIN(ABSTRACT_INSENTIENT),
CHICKEN(ABSTRACT_ANIMAL),
COW(ABSTRACT_ANIMAL),
MOOSHROOM(COW),
PANDA(ABSTRACT_INSENTIENT),
PIG(ABSTRACT_ANIMAL),
POLAR_BEAR(ABSTRACT_ANIMAL),
RABBIT(ABSTRACT_ANIMAL),
SHEEP(ABSTRACT_ANIMAL),
TURTLE(ABSTRACT_ANIMAL),
FOX(ABSTRACT_ANIMAL),
FROG(ABSTRACT_ANIMAL),
GOAT(ABSTRACT_ANIMAL),
ABSTRACT_TAMEABLE_ANIMAL(ABSTRACT_ANIMAL, null),
CAT(ABSTRACT_TAMEABLE_ANIMAL),
OCELOT(ABSTRACT_TAMEABLE_ANIMAL),
WOLF(ABSTRACT_TAMEABLE_ANIMAL),
ABSTRACT_PARROT(ABSTRACT_TAMEABLE_ANIMAL, null),
PARROT(ABSTRACT_PARROT),
// Horses
ABSTRACT_HORSE(ABSTRACT_ANIMAL, null),
CHESTED_HORSE(ABSTRACT_HORSE, null),
DONKEY(CHESTED_HORSE),
MULE(CHESTED_HORSE),
LLAMA(CHESTED_HORSE),
TRADER_LLAMA(CHESTED_HORSE),
HORSE(ABSTRACT_HORSE),
SKELETON_HORSE(ABSTRACT_HORSE),
ZOMBIE_HORSE(ABSTRACT_HORSE),
CAMEL(ABSTRACT_HORSE),
// Golem
ABSTRACT_GOLEM(ABSTRACT_CREATURE, null), ABSTRACT_GOLEM(ABSTRACT_CREATURE, null),
SNOW_GOLEM(ABSTRACT_GOLEM), SNOW_GOLEM(ABSTRACT_GOLEM),
IRON_GOLEM(ABSTRACT_GOLEM), IRON_GOLEM(ABSTRACT_GOLEM),
SHULKER(ABSTRACT_GOLEM), SHULKER(ABSTRACT_GOLEM),
// Fish // Water mobs
ABSTRACT_FISHES(ABSTRACT_CREATURE, null), ABSTRACT_WATERMOB(ABSTRACT_CREATURE, null),
COD(ABSTRACT_FISHES), DOLPHIN(ABSTRACT_WATERMOB),
SQUID(ABSTRACT_WATERMOB),
GLOW_SQUID(SQUID),
ABSTRACT_FISHES(ABSTRACT_WATERMOB, null),
PUFFERFISH(ABSTRACT_FISHES), PUFFERFISH(ABSTRACT_FISHES),
SALMON(ABSTRACT_FISHES), TADPOLE(ABSTRACT_FISHES),
TROPICAL_FISH(ABSTRACT_FISHES),
ABSTRACT_SCHOOLING_FISH(ABSTRACT_FISHES, null),
COD(ABSTRACT_SCHOOLING_FISH),
SALMON(ABSTRACT_SCHOOLING_FISH),
TROPICAL_FISH(ABSTRACT_SCHOOLING_FISH),
// Ageable mobs and (tamable) animals
ABSTRACT_AGEABLE(ABSTRACT_CREATURE, null),
ABSTRACT_VILLAGER(ABSTRACT_AGEABLE, null),
VILLAGER(ABSTRACT_VILLAGER),
WANDERING_TRADER(ABSTRACT_VILLAGER),
ABSTRACT_ANIMAL(ABSTRACT_AGEABLE, null),
AXOLOTL(ABSTRACT_ANIMAL),
CHICKEN(ABSTRACT_ANIMAL),
PANDA(ABSTRACT_ANIMAL),
PIG(ABSTRACT_ANIMAL),
POLAR_BEAR(ABSTRACT_ANIMAL),
RABBIT(ABSTRACT_ANIMAL),
SHEEP(ABSTRACT_ANIMAL),
BEE(ABSTRACT_ANIMAL),
TURTLE(ABSTRACT_ANIMAL),
FOX(ABSTRACT_ANIMAL),
FROG(ABSTRACT_ANIMAL),
GOAT(ABSTRACT_ANIMAL),
HOGLIN(ABSTRACT_ANIMAL),
STRIDER(ABSTRACT_ANIMAL),
COW(ABSTRACT_ANIMAL),
MOOSHROOM(COW),
ABSTRACT_TAMEABLE_ANIMAL(ABSTRACT_ANIMAL, null),
CAT(ABSTRACT_TAMEABLE_ANIMAL),
OCELOT(ABSTRACT_TAMEABLE_ANIMAL),
WOLF(ABSTRACT_TAMEABLE_ANIMAL),
PARROT(ABSTRACT_TAMEABLE_ANIMAL),
ABSTRACT_HORSE(ABSTRACT_ANIMAL, null),
HORSE(ABSTRACT_HORSE),
SKELETON_HORSE(ABSTRACT_HORSE),
ZOMBIE_HORSE(ABSTRACT_HORSE),
CAMEL(ABSTRACT_HORSE),
CHESTED_HORSE(ABSTRACT_HORSE, null),
DONKEY(CHESTED_HORSE),
MULE(CHESTED_HORSE),
LLAMA(CHESTED_HORSE),
TRADER_LLAMA(LLAMA),
// Monsters // Monsters
ABSTRACT_MONSTER(ABSTRACT_CREATURE, null), ABSTRACT_MONSTER(ABSTRACT_CREATURE, null),
@ -120,110 +187,42 @@ public enum EntityTypes1_19_3 implements EntityType {
GIANT(ABSTRACT_MONSTER), GIANT(ABSTRACT_MONSTER),
SILVERFISH(ABSTRACT_MONSTER), SILVERFISH(ABSTRACT_MONSTER),
VEX(ABSTRACT_MONSTER), VEX(ABSTRACT_MONSTER),
WITCH(ABSTRACT_MONSTER),
WITHER(ABSTRACT_MONSTER), WITHER(ABSTRACT_MONSTER),
RAVAGER(ABSTRACT_MONSTER),
ABSTRACT_PIGLIN(ABSTRACT_MONSTER, null),
PIGLIN(ABSTRACT_PIGLIN),
PIGLIN_BRUTE(ABSTRACT_PIGLIN),
HOGLIN(ABSTRACT_ANIMAL),
STRIDER(ABSTRACT_ANIMAL),
TADPOLE(ABSTRACT_FISHES),
ZOGLIN(ABSTRACT_MONSTER), ZOGLIN(ABSTRACT_MONSTER),
WARDEN(ABSTRACT_MONSTER), WARDEN(ABSTRACT_MONSTER),
// Illagers
ABSTRACT_ILLAGER_BASE(ABSTRACT_MONSTER, null),
ABSTRACT_EVO_ILLU_ILLAGER(ABSTRACT_ILLAGER_BASE, null),
EVOKER(ABSTRACT_EVO_ILLU_ILLAGER),
ILLUSIONER(ABSTRACT_EVO_ILLU_ILLAGER),
VINDICATOR(ABSTRACT_ILLAGER_BASE),
PILLAGER(ABSTRACT_ILLAGER_BASE),
// Skeletons
ABSTRACT_SKELETON(ABSTRACT_MONSTER, null), ABSTRACT_SKELETON(ABSTRACT_MONSTER, null),
SKELETON(ABSTRACT_SKELETON), SKELETON(ABSTRACT_SKELETON),
STRAY(ABSTRACT_SKELETON), STRAY(ABSTRACT_SKELETON),
WITHER_SKELETON(ABSTRACT_SKELETON), WITHER_SKELETON(ABSTRACT_SKELETON),
// Guardians
GUARDIAN(ABSTRACT_MONSTER),
ELDER_GUARDIAN(GUARDIAN),
// Spiders
SPIDER(ABSTRACT_MONSTER),
CAVE_SPIDER(SPIDER),
// Zombies
ZOMBIE(ABSTRACT_MONSTER), ZOMBIE(ABSTRACT_MONSTER),
DROWNED(ZOMBIE), DROWNED(ZOMBIE),
HUSK(ZOMBIE), HUSK(ZOMBIE),
ZOMBIFIED_PIGLIN(ZOMBIE), ZOMBIFIED_PIGLIN(ZOMBIE),
ZOMBIE_VILLAGER(ZOMBIE), ZOMBIE_VILLAGER(ZOMBIE),
// Flying entities GUARDIAN(ABSTRACT_MONSTER),
ABSTRACT_FLYING(ABSTRACT_INSENTIENT, null), ELDER_GUARDIAN(GUARDIAN),
GHAST(ABSTRACT_FLYING),
PHANTOM(ABSTRACT_FLYING),
ABSTRACT_AMBIENT(ABSTRACT_INSENTIENT, null), SPIDER(ABSTRACT_MONSTER),
BAT(ABSTRACT_AMBIENT), CAVE_SPIDER(SPIDER),
ALLAY(ABSTRACT_CREATURE),
ABSTRACT_WATERMOB(ABSTRACT_INSENTIENT, null), ABSTRACT_PIGLIN(ABSTRACT_MONSTER, null),
SQUID(ABSTRACT_WATERMOB), PIGLIN(ABSTRACT_PIGLIN),
GLOW_SQUID(SQUID), PIGLIN_BRUTE(ABSTRACT_PIGLIN),
// Slimes // Raiders
SLIME(ABSTRACT_INSENTIENT), ABSTRACT_RAIDER(ABSTRACT_MONSTER, null),
MAGMA_CUBE(SLIME), WITCH(ABSTRACT_RAIDER),
RAVAGER(ABSTRACT_RAIDER),
// Hangable objects ABSTRACT_ILLAGER_BASE(ABSTRACT_RAIDER, null),
ABSTRACT_HANGING(ENTITY, null), ABSTRACT_EVO_ILLU_ILLAGER(ABSTRACT_ILLAGER_BASE, null),
LEASH_KNOT(ABSTRACT_HANGING), VINDICATOR(ABSTRACT_ILLAGER_BASE),
ITEM_FRAME(ABSTRACT_HANGING), PILLAGER(ABSTRACT_ILLAGER_BASE),
GLOW_ITEM_FRAME(ITEM_FRAME), EVOKER(ABSTRACT_EVO_ILLU_ILLAGER),
PAINTING(ABSTRACT_HANGING), ILLUSIONER(ABSTRACT_EVO_ILLU_ILLAGER);
ABSTRACT_LIGHTNING(ENTITY, null),
LIGHTNING_BOLT(ABSTRACT_LIGHTNING),
// Arrows
ABSTRACT_ARROW(ENTITY, null),
ARROW(ABSTRACT_ARROW),
SPECTRAL_ARROW(ABSTRACT_ARROW),
TRIDENT(ABSTRACT_ARROW),
// Fireballs
ABSTRACT_FIREBALL(ENTITY, null),
DRAGON_FIREBALL(ABSTRACT_FIREBALL),
FIREBALL(ABSTRACT_FIREBALL),
SMALL_FIREBALL(ABSTRACT_FIREBALL),
WITHER_SKULL(ABSTRACT_FIREBALL),
// Projectiles
PROJECTILE_ABSTRACT(ENTITY, null),
SNOWBALL(PROJECTILE_ABSTRACT),
ENDER_PEARL(PROJECTILE_ABSTRACT),
EGG(PROJECTILE_ABSTRACT),
POTION(PROJECTILE_ABSTRACT),
EXPERIENCE_BOTTLE(PROJECTILE_ABSTRACT),
// Vehicles
MINECART_ABSTRACT(ENTITY, null),
CHESTED_MINECART_ABSTRACT(MINECART_ABSTRACT, null),
CHEST_MINECART(CHESTED_MINECART_ABSTRACT),
HOPPER_MINECART(CHESTED_MINECART_ABSTRACT),
MINECART(MINECART_ABSTRACT),
FURNACE_MINECART(MINECART_ABSTRACT),
COMMAND_BLOCK_MINECART(MINECART_ABSTRACT),
TNT_MINECART(MINECART_ABSTRACT),
SPAWNER_MINECART(MINECART_ABSTRACT),
BOAT(ENTITY),
CHEST_BOAT(BOAT);
private static final EntityType[] TYPES = EntityTypeUtil.createSizedArray(values()); private static final EntityType[] TYPES = EntityTypeUtil.createSizedArray(values());
private final EntityType parent; private final EntityType parent;

Datei anzeigen

@ -38,85 +38,152 @@ public enum EntityTypes1_19_4 implements EntityType {
EXPERIENCE_ORB(ENTITY), EXPERIENCE_ORB(ENTITY),
EYE_OF_ENDER(ENTITY), EYE_OF_ENDER(ENTITY),
FALLING_BLOCK(ENTITY), FALLING_BLOCK(ENTITY),
FIREWORK_ROCKET(ENTITY),
ITEM(ENTITY), ITEM(ENTITY),
LLAMA_SPIT(ENTITY),
TNT(ENTITY), TNT(ENTITY),
SHULKER_BULLET(ENTITY),
FISHING_BOBBER(ENTITY),
LIVINGENTITY(ENTITY, null),
ARMOR_STAND(LIVINGENTITY),
MARKER(ENTITY), MARKER(ENTITY),
PLAYER(LIVINGENTITY), LIGHTNING_BOLT(ENTITY),
INTERACTION(ENTITY),
DISPLAY(ENTITY, null), DISPLAY(ENTITY, null),
BLOCK_DISPLAY(DISPLAY), BLOCK_DISPLAY(DISPLAY),
ITEM_DISPLAY(DISPLAY), ITEM_DISPLAY(DISPLAY),
TEXT_DISPLAY(DISPLAY), TEXT_DISPLAY(DISPLAY),
INTERACTION(ENTITY),
// Hanging entities
ABSTRACT_HANGING(ENTITY, null),
LEASH_KNOT(ABSTRACT_HANGING),
PAINTING(ABSTRACT_HANGING),
ITEM_FRAME(ABSTRACT_HANGING),
GLOW_ITEM_FRAME(ITEM_FRAME),
// Projectiles
PROJECTILE_ABSTRACT(ENTITY, null), // Not actually its own abstract type, but useful for categorizing
SNOWBALL(PROJECTILE_ABSTRACT),
ENDER_PEARL(PROJECTILE_ABSTRACT),
EGG(PROJECTILE_ABSTRACT),
POTION(PROJECTILE_ABSTRACT),
EXPERIENCE_BOTTLE(PROJECTILE_ABSTRACT),
FIREWORK_ROCKET(PROJECTILE_ABSTRACT),
LLAMA_SPIT(PROJECTILE_ABSTRACT),
SHULKER_BULLET(PROJECTILE_ABSTRACT),
FISHING_BOBBER(PROJECTILE_ABSTRACT),
WITHER_SKULL(PROJECTILE_ABSTRACT),
DRAGON_FIREBALL(PROJECTILE_ABSTRACT), // Doesn't actually inherit fireball
ABSTRACT_ARROW(PROJECTILE_ABSTRACT, null),
ARROW(ABSTRACT_ARROW),
SPECTRAL_ARROW(ABSTRACT_ARROW),
TRIDENT(ABSTRACT_ARROW),
ABSTRACT_FIREBALL(ENTITY, null),
FIREBALL(ABSTRACT_FIREBALL),
SMALL_FIREBALL(ABSTRACT_FIREBALL),
// Vehicles
VEHICLE(ENTITY, null),
BOAT(VEHICLE),
MINECART_ABSTRACT(VEHICLE, null),
MINECART(MINECART_ABSTRACT),
FURNACE_MINECART(MINECART_ABSTRACT),
COMMAND_BLOCK_MINECART(MINECART_ABSTRACT),
TNT_MINECART(MINECART_ABSTRACT),
SPAWNER_MINECART(MINECART_ABSTRACT),
CHEST_BOAT(BOAT),
CHESTED_MINECART_ABSTRACT(MINECART_ABSTRACT, null),
CHEST_MINECART(CHESTED_MINECART_ABSTRACT),
HOPPER_MINECART(CHESTED_MINECART_ABSTRACT),
// Living entities as a larger subclass
LIVINGENTITY(ENTITY, null),
ARMOR_STAND(LIVINGENTITY),
PLAYER(LIVINGENTITY),
// Mobs as a larger subclass
ABSTRACT_INSENTIENT(LIVINGENTITY, null), ABSTRACT_INSENTIENT(LIVINGENTITY, null),
ENDER_DRAGON(ABSTRACT_INSENTIENT), ENDER_DRAGON(ABSTRACT_INSENTIENT),
BEE(ABSTRACT_INSENTIENT), SLIME(ABSTRACT_INSENTIENT),
MAGMA_CUBE(SLIME),
// Ambient mobs
ABSTRACT_AMBIENT(ABSTRACT_INSENTIENT, null),
BAT(ABSTRACT_AMBIENT),
// Flying mobs
ABSTRACT_FLYING(ABSTRACT_INSENTIENT, null),
GHAST(ABSTRACT_FLYING),
PHANTOM(ABSTRACT_FLYING),
// Pathfinder mobs and its subclasses
ABSTRACT_CREATURE(ABSTRACT_INSENTIENT, null), ABSTRACT_CREATURE(ABSTRACT_INSENTIENT, null),
ALLAY(ABSTRACT_CREATURE),
ABSTRACT_AGEABLE(ABSTRACT_CREATURE, null),
VILLAGER(ABSTRACT_AGEABLE),
WANDERING_TRADER(ABSTRACT_AGEABLE),
// Animals
ABSTRACT_ANIMAL(ABSTRACT_AGEABLE, null),
AXOLOTL(ABSTRACT_ANIMAL),
DOLPHIN(ABSTRACT_INSENTIENT),
CHICKEN(ABSTRACT_ANIMAL),
COW(ABSTRACT_ANIMAL),
MOOSHROOM(COW),
PANDA(ABSTRACT_INSENTIENT),
PIG(ABSTRACT_ANIMAL),
POLAR_BEAR(ABSTRACT_ANIMAL),
RABBIT(ABSTRACT_ANIMAL),
SHEEP(ABSTRACT_ANIMAL),
TURTLE(ABSTRACT_ANIMAL),
FOX(ABSTRACT_ANIMAL),
FROG(ABSTRACT_ANIMAL),
GOAT(ABSTRACT_ANIMAL),
SNIFFER(ABSTRACT_ANIMAL),
ABSTRACT_TAMEABLE_ANIMAL(ABSTRACT_ANIMAL, null),
CAT(ABSTRACT_TAMEABLE_ANIMAL),
OCELOT(ABSTRACT_TAMEABLE_ANIMAL),
WOLF(ABSTRACT_TAMEABLE_ANIMAL),
ABSTRACT_PARROT(ABSTRACT_TAMEABLE_ANIMAL, null),
PARROT(ABSTRACT_PARROT),
// Horses
ABSTRACT_HORSE(ABSTRACT_ANIMAL, null),
CHESTED_HORSE(ABSTRACT_HORSE, null),
DONKEY(CHESTED_HORSE),
MULE(CHESTED_HORSE),
LLAMA(CHESTED_HORSE),
TRADER_LLAMA(CHESTED_HORSE),
HORSE(ABSTRACT_HORSE),
SKELETON_HORSE(ABSTRACT_HORSE),
ZOMBIE_HORSE(ABSTRACT_HORSE),
CAMEL(ABSTRACT_HORSE),
// Golem
ABSTRACT_GOLEM(ABSTRACT_CREATURE, null), ABSTRACT_GOLEM(ABSTRACT_CREATURE, null),
SNOW_GOLEM(ABSTRACT_GOLEM), SNOW_GOLEM(ABSTRACT_GOLEM),
IRON_GOLEM(ABSTRACT_GOLEM), IRON_GOLEM(ABSTRACT_GOLEM),
SHULKER(ABSTRACT_GOLEM), SHULKER(ABSTRACT_GOLEM),
// Fish // Water mobs
ABSTRACT_FISHES(ABSTRACT_CREATURE, null), ABSTRACT_WATERMOB(ABSTRACT_CREATURE, null),
COD(ABSTRACT_FISHES), DOLPHIN(ABSTRACT_WATERMOB),
SQUID(ABSTRACT_WATERMOB),
GLOW_SQUID(SQUID),
ABSTRACT_FISHES(ABSTRACT_WATERMOB, null),
PUFFERFISH(ABSTRACT_FISHES), PUFFERFISH(ABSTRACT_FISHES),
SALMON(ABSTRACT_FISHES), TADPOLE(ABSTRACT_FISHES),
TROPICAL_FISH(ABSTRACT_FISHES),
ABSTRACT_SCHOOLING_FISH(ABSTRACT_FISHES, null),
COD(ABSTRACT_SCHOOLING_FISH),
SALMON(ABSTRACT_SCHOOLING_FISH),
TROPICAL_FISH(ABSTRACT_SCHOOLING_FISH),
// Ageable mobs and (tamable) animals
ABSTRACT_AGEABLE(ABSTRACT_CREATURE, null),
ABSTRACT_VILLAGER(ABSTRACT_AGEABLE, null),
VILLAGER(ABSTRACT_VILLAGER),
WANDERING_TRADER(ABSTRACT_VILLAGER),
ABSTRACT_ANIMAL(ABSTRACT_AGEABLE, null),
AXOLOTL(ABSTRACT_ANIMAL),
CHICKEN(ABSTRACT_ANIMAL),
PANDA(ABSTRACT_ANIMAL),
PIG(ABSTRACT_ANIMAL),
POLAR_BEAR(ABSTRACT_ANIMAL),
RABBIT(ABSTRACT_ANIMAL),
SHEEP(ABSTRACT_ANIMAL),
BEE(ABSTRACT_ANIMAL),
TURTLE(ABSTRACT_ANIMAL),
FOX(ABSTRACT_ANIMAL),
FROG(ABSTRACT_ANIMAL),
GOAT(ABSTRACT_ANIMAL),
HOGLIN(ABSTRACT_ANIMAL),
STRIDER(ABSTRACT_ANIMAL),
SNIFFER(ABSTRACT_ANIMAL),
COW(ABSTRACT_ANIMAL),
MOOSHROOM(COW),
ABSTRACT_TAMEABLE_ANIMAL(ABSTRACT_ANIMAL, null),
CAT(ABSTRACT_TAMEABLE_ANIMAL),
OCELOT(ABSTRACT_TAMEABLE_ANIMAL),
WOLF(ABSTRACT_TAMEABLE_ANIMAL),
PARROT(ABSTRACT_TAMEABLE_ANIMAL),
ABSTRACT_HORSE(ABSTRACT_ANIMAL, null),
HORSE(ABSTRACT_HORSE),
SKELETON_HORSE(ABSTRACT_HORSE),
ZOMBIE_HORSE(ABSTRACT_HORSE),
CAMEL(ABSTRACT_HORSE),
CHESTED_HORSE(ABSTRACT_HORSE, null),
DONKEY(CHESTED_HORSE),
MULE(CHESTED_HORSE),
LLAMA(CHESTED_HORSE),
TRADER_LLAMA(LLAMA),
// Monsters // Monsters
ABSTRACT_MONSTER(ABSTRACT_CREATURE, null), ABSTRACT_MONSTER(ABSTRACT_CREATURE, null),
@ -127,110 +194,42 @@ public enum EntityTypes1_19_4 implements EntityType {
GIANT(ABSTRACT_MONSTER), GIANT(ABSTRACT_MONSTER),
SILVERFISH(ABSTRACT_MONSTER), SILVERFISH(ABSTRACT_MONSTER),
VEX(ABSTRACT_MONSTER), VEX(ABSTRACT_MONSTER),
WITCH(ABSTRACT_MONSTER),
WITHER(ABSTRACT_MONSTER), WITHER(ABSTRACT_MONSTER),
RAVAGER(ABSTRACT_MONSTER),
ABSTRACT_PIGLIN(ABSTRACT_MONSTER, null),
PIGLIN(ABSTRACT_PIGLIN),
PIGLIN_BRUTE(ABSTRACT_PIGLIN),
HOGLIN(ABSTRACT_ANIMAL),
STRIDER(ABSTRACT_ANIMAL),
TADPOLE(ABSTRACT_FISHES),
ZOGLIN(ABSTRACT_MONSTER), ZOGLIN(ABSTRACT_MONSTER),
WARDEN(ABSTRACT_MONSTER), WARDEN(ABSTRACT_MONSTER),
// Illagers
ABSTRACT_ILLAGER_BASE(ABSTRACT_MONSTER, null),
ABSTRACT_EVO_ILLU_ILLAGER(ABSTRACT_ILLAGER_BASE, null),
EVOKER(ABSTRACT_EVO_ILLU_ILLAGER),
ILLUSIONER(ABSTRACT_EVO_ILLU_ILLAGER),
VINDICATOR(ABSTRACT_ILLAGER_BASE),
PILLAGER(ABSTRACT_ILLAGER_BASE),
// Skeletons
ABSTRACT_SKELETON(ABSTRACT_MONSTER, null), ABSTRACT_SKELETON(ABSTRACT_MONSTER, null),
SKELETON(ABSTRACT_SKELETON), SKELETON(ABSTRACT_SKELETON),
STRAY(ABSTRACT_SKELETON), STRAY(ABSTRACT_SKELETON),
WITHER_SKELETON(ABSTRACT_SKELETON), WITHER_SKELETON(ABSTRACT_SKELETON),
// Guardians
GUARDIAN(ABSTRACT_MONSTER),
ELDER_GUARDIAN(GUARDIAN),
// Spiders
SPIDER(ABSTRACT_MONSTER),
CAVE_SPIDER(SPIDER),
// Zombies
ZOMBIE(ABSTRACT_MONSTER), ZOMBIE(ABSTRACT_MONSTER),
DROWNED(ZOMBIE), DROWNED(ZOMBIE),
HUSK(ZOMBIE), HUSK(ZOMBIE),
ZOMBIFIED_PIGLIN(ZOMBIE), ZOMBIFIED_PIGLIN(ZOMBIE),
ZOMBIE_VILLAGER(ZOMBIE), ZOMBIE_VILLAGER(ZOMBIE),
// Flying entities GUARDIAN(ABSTRACT_MONSTER),
ABSTRACT_FLYING(ABSTRACT_INSENTIENT, null), ELDER_GUARDIAN(GUARDIAN),
GHAST(ABSTRACT_FLYING),
PHANTOM(ABSTRACT_FLYING),
ABSTRACT_AMBIENT(ABSTRACT_INSENTIENT, null), SPIDER(ABSTRACT_MONSTER),
BAT(ABSTRACT_AMBIENT), CAVE_SPIDER(SPIDER),
ALLAY(ABSTRACT_CREATURE),
ABSTRACT_WATERMOB(ABSTRACT_INSENTIENT, null), ABSTRACT_PIGLIN(ABSTRACT_MONSTER, null),
SQUID(ABSTRACT_WATERMOB), PIGLIN(ABSTRACT_PIGLIN),
GLOW_SQUID(SQUID), PIGLIN_BRUTE(ABSTRACT_PIGLIN),
// Slimes // Raiders
SLIME(ABSTRACT_INSENTIENT), ABSTRACT_RAIDER(ABSTRACT_MONSTER, null),
MAGMA_CUBE(SLIME), WITCH(ABSTRACT_RAIDER),
RAVAGER(ABSTRACT_RAIDER),
// Hangable objects ABSTRACT_ILLAGER_BASE(ABSTRACT_RAIDER, null),
ABSTRACT_HANGING(ENTITY, null), ABSTRACT_EVO_ILLU_ILLAGER(ABSTRACT_ILLAGER_BASE, null),
LEASH_KNOT(ABSTRACT_HANGING), VINDICATOR(ABSTRACT_ILLAGER_BASE),
ITEM_FRAME(ABSTRACT_HANGING), PILLAGER(ABSTRACT_ILLAGER_BASE),
GLOW_ITEM_FRAME(ITEM_FRAME), EVOKER(ABSTRACT_EVO_ILLU_ILLAGER),
PAINTING(ABSTRACT_HANGING), ILLUSIONER(ABSTRACT_EVO_ILLU_ILLAGER);
ABSTRACT_LIGHTNING(ENTITY, null),
LIGHTNING_BOLT(ABSTRACT_LIGHTNING),
// Arrows
ABSTRACT_ARROW(ENTITY, null),
ARROW(ABSTRACT_ARROW),
SPECTRAL_ARROW(ABSTRACT_ARROW),
TRIDENT(ABSTRACT_ARROW),
// Fireballs
ABSTRACT_FIREBALL(ENTITY, null),
DRAGON_FIREBALL(ABSTRACT_FIREBALL),
FIREBALL(ABSTRACT_FIREBALL),
SMALL_FIREBALL(ABSTRACT_FIREBALL),
WITHER_SKULL(ABSTRACT_FIREBALL),
// Projectiles
PROJECTILE_ABSTRACT(ENTITY, null),
SNOWBALL(PROJECTILE_ABSTRACT),
ENDER_PEARL(PROJECTILE_ABSTRACT),
EGG(PROJECTILE_ABSTRACT),
POTION(PROJECTILE_ABSTRACT),
EXPERIENCE_BOTTLE(PROJECTILE_ABSTRACT),
// Vehicles
MINECART_ABSTRACT(ENTITY, null),
CHESTED_MINECART_ABSTRACT(MINECART_ABSTRACT, null),
CHEST_MINECART(CHESTED_MINECART_ABSTRACT),
HOPPER_MINECART(CHESTED_MINECART_ABSTRACT),
MINECART(MINECART_ABSTRACT),
FURNACE_MINECART(MINECART_ABSTRACT),
COMMAND_BLOCK_MINECART(MINECART_ABSTRACT),
TNT_MINECART(MINECART_ABSTRACT),
SPAWNER_MINECART(MINECART_ABSTRACT),
BOAT(ENTITY),
CHEST_BOAT(BOAT);
private static final EntityType[] TYPES = EntityTypeUtil.createSizedArray(values()); private static final EntityType[] TYPES = EntityTypeUtil.createSizedArray(values());
private final EntityType parent; private final EntityType parent;

Datei anzeigen

@ -38,85 +38,153 @@ public enum EntityTypes1_20_3 implements EntityType {
EXPERIENCE_ORB(ENTITY), EXPERIENCE_ORB(ENTITY),
EYE_OF_ENDER(ENTITY), EYE_OF_ENDER(ENTITY),
FALLING_BLOCK(ENTITY), FALLING_BLOCK(ENTITY),
FIREWORK_ROCKET(ENTITY),
ITEM(ENTITY), ITEM(ENTITY),
LLAMA_SPIT(ENTITY),
TNT(ENTITY), TNT(ENTITY),
SHULKER_BULLET(ENTITY),
FISHING_BOBBER(ENTITY),
LIVINGENTITY(ENTITY, null),
ARMOR_STAND(LIVINGENTITY),
MARKER(ENTITY), MARKER(ENTITY),
PLAYER(LIVINGENTITY), LIGHTNING_BOLT(ENTITY),
INTERACTION(ENTITY),
DISPLAY(ENTITY, null), DISPLAY(ENTITY, null),
BLOCK_DISPLAY(DISPLAY), BLOCK_DISPLAY(DISPLAY),
ITEM_DISPLAY(DISPLAY), ITEM_DISPLAY(DISPLAY),
TEXT_DISPLAY(DISPLAY), TEXT_DISPLAY(DISPLAY),
INTERACTION(ENTITY),
// Hanging entities
ABSTRACT_HANGING(ENTITY, null),
LEASH_KNOT(ABSTRACT_HANGING),
PAINTING(ABSTRACT_HANGING),
ITEM_FRAME(ABSTRACT_HANGING),
GLOW_ITEM_FRAME(ITEM_FRAME),
// Projectiles
PROJECTILE_ABSTRACT(ENTITY, null), // Not actually its own abstract type, but useful for categorizing
SNOWBALL(PROJECTILE_ABSTRACT),
ENDER_PEARL(PROJECTILE_ABSTRACT),
EGG(PROJECTILE_ABSTRACT),
POTION(PROJECTILE_ABSTRACT),
EXPERIENCE_BOTTLE(PROJECTILE_ABSTRACT),
FIREWORK_ROCKET(PROJECTILE_ABSTRACT),
LLAMA_SPIT(PROJECTILE_ABSTRACT),
SHULKER_BULLET(PROJECTILE_ABSTRACT),
FISHING_BOBBER(PROJECTILE_ABSTRACT),
WITHER_SKULL(PROJECTILE_ABSTRACT),
DRAGON_FIREBALL(PROJECTILE_ABSTRACT), // Doesn't actually inherit fireball
WIND_CHARGE(PROJECTILE_ABSTRACT),
ABSTRACT_ARROW(PROJECTILE_ABSTRACT, null),
ARROW(ABSTRACT_ARROW),
SPECTRAL_ARROW(ABSTRACT_ARROW),
TRIDENT(ABSTRACT_ARROW),
ABSTRACT_FIREBALL(ENTITY, null),
FIREBALL(ABSTRACT_FIREBALL),
SMALL_FIREBALL(ABSTRACT_FIREBALL),
// Vehicles
VEHICLE(ENTITY, null),
BOAT(VEHICLE),
MINECART_ABSTRACT(VEHICLE, null),
MINECART(MINECART_ABSTRACT),
FURNACE_MINECART(MINECART_ABSTRACT),
COMMAND_BLOCK_MINECART(MINECART_ABSTRACT),
TNT_MINECART(MINECART_ABSTRACT),
SPAWNER_MINECART(MINECART_ABSTRACT),
CHEST_BOAT(BOAT),
CHESTED_MINECART_ABSTRACT(MINECART_ABSTRACT, null),
CHEST_MINECART(CHESTED_MINECART_ABSTRACT),
HOPPER_MINECART(CHESTED_MINECART_ABSTRACT),
// Living entities as a larger subclass
LIVINGENTITY(ENTITY, null),
ARMOR_STAND(LIVINGENTITY),
PLAYER(LIVINGENTITY),
// Mobs as a larger subclass
ABSTRACT_INSENTIENT(LIVINGENTITY, null), ABSTRACT_INSENTIENT(LIVINGENTITY, null),
ENDER_DRAGON(ABSTRACT_INSENTIENT), ENDER_DRAGON(ABSTRACT_INSENTIENT),
BEE(ABSTRACT_INSENTIENT), SLIME(ABSTRACT_INSENTIENT),
MAGMA_CUBE(SLIME),
// Ambient mobs
ABSTRACT_AMBIENT(ABSTRACT_INSENTIENT, null),
BAT(ABSTRACT_AMBIENT),
// Flying mobs
ABSTRACT_FLYING(ABSTRACT_INSENTIENT, null),
GHAST(ABSTRACT_FLYING),
PHANTOM(ABSTRACT_FLYING),
// Pathfinder mobs and its subclasses
ABSTRACT_CREATURE(ABSTRACT_INSENTIENT, null), ABSTRACT_CREATURE(ABSTRACT_INSENTIENT, null),
ALLAY(ABSTRACT_CREATURE),
ABSTRACT_AGEABLE(ABSTRACT_CREATURE, null),
VILLAGER(ABSTRACT_AGEABLE),
WANDERING_TRADER(ABSTRACT_AGEABLE),
// Animals
ABSTRACT_ANIMAL(ABSTRACT_AGEABLE, null),
AXOLOTL(ABSTRACT_ANIMAL),
DOLPHIN(ABSTRACT_INSENTIENT),
CHICKEN(ABSTRACT_ANIMAL),
COW(ABSTRACT_ANIMAL),
MOOSHROOM(COW),
PANDA(ABSTRACT_INSENTIENT),
PIG(ABSTRACT_ANIMAL),
POLAR_BEAR(ABSTRACT_ANIMAL),
RABBIT(ABSTRACT_ANIMAL),
SHEEP(ABSTRACT_ANIMAL),
TURTLE(ABSTRACT_ANIMAL),
FOX(ABSTRACT_ANIMAL),
FROG(ABSTRACT_ANIMAL),
GOAT(ABSTRACT_ANIMAL),
SNIFFER(ABSTRACT_ANIMAL),
ABSTRACT_TAMEABLE_ANIMAL(ABSTRACT_ANIMAL, null),
CAT(ABSTRACT_TAMEABLE_ANIMAL),
OCELOT(ABSTRACT_TAMEABLE_ANIMAL),
WOLF(ABSTRACT_TAMEABLE_ANIMAL),
ABSTRACT_PARROT(ABSTRACT_TAMEABLE_ANIMAL, null),
PARROT(ABSTRACT_PARROT),
// Horses
ABSTRACT_HORSE(ABSTRACT_ANIMAL, null),
CHESTED_HORSE(ABSTRACT_HORSE, null),
DONKEY(CHESTED_HORSE),
MULE(CHESTED_HORSE),
LLAMA(CHESTED_HORSE),
TRADER_LLAMA(CHESTED_HORSE),
HORSE(ABSTRACT_HORSE),
SKELETON_HORSE(ABSTRACT_HORSE),
ZOMBIE_HORSE(ABSTRACT_HORSE),
CAMEL(ABSTRACT_HORSE),
// Golem
ABSTRACT_GOLEM(ABSTRACT_CREATURE, null), ABSTRACT_GOLEM(ABSTRACT_CREATURE, null),
SNOW_GOLEM(ABSTRACT_GOLEM), SNOW_GOLEM(ABSTRACT_GOLEM),
IRON_GOLEM(ABSTRACT_GOLEM), IRON_GOLEM(ABSTRACT_GOLEM),
SHULKER(ABSTRACT_GOLEM), SHULKER(ABSTRACT_GOLEM),
// Fish // Water mobs
ABSTRACT_FISHES(ABSTRACT_CREATURE, null), ABSTRACT_WATERMOB(ABSTRACT_CREATURE, null),
COD(ABSTRACT_FISHES), DOLPHIN(ABSTRACT_WATERMOB),
SQUID(ABSTRACT_WATERMOB),
GLOW_SQUID(SQUID),
ABSTRACT_FISHES(ABSTRACT_WATERMOB, null),
PUFFERFISH(ABSTRACT_FISHES), PUFFERFISH(ABSTRACT_FISHES),
SALMON(ABSTRACT_FISHES), TADPOLE(ABSTRACT_FISHES),
TROPICAL_FISH(ABSTRACT_FISHES),
ABSTRACT_SCHOOLING_FISH(ABSTRACT_FISHES, null),
COD(ABSTRACT_SCHOOLING_FISH),
SALMON(ABSTRACT_SCHOOLING_FISH),
TROPICAL_FISH(ABSTRACT_SCHOOLING_FISH),
// Ageable mobs and (tamable) animals
ABSTRACT_AGEABLE(ABSTRACT_CREATURE, null),
ABSTRACT_VILLAGER(ABSTRACT_AGEABLE, null),
VILLAGER(ABSTRACT_VILLAGER),
WANDERING_TRADER(ABSTRACT_VILLAGER),
ABSTRACT_ANIMAL(ABSTRACT_AGEABLE, null),
AXOLOTL(ABSTRACT_ANIMAL),
CHICKEN(ABSTRACT_ANIMAL),
PANDA(ABSTRACT_ANIMAL),
PIG(ABSTRACT_ANIMAL),
POLAR_BEAR(ABSTRACT_ANIMAL),
RABBIT(ABSTRACT_ANIMAL),
SHEEP(ABSTRACT_ANIMAL),
BEE(ABSTRACT_ANIMAL),
TURTLE(ABSTRACT_ANIMAL),
FOX(ABSTRACT_ANIMAL),
FROG(ABSTRACT_ANIMAL),
GOAT(ABSTRACT_ANIMAL),
HOGLIN(ABSTRACT_ANIMAL),
STRIDER(ABSTRACT_ANIMAL),
SNIFFER(ABSTRACT_ANIMAL),
COW(ABSTRACT_ANIMAL),
MOOSHROOM(COW),
ABSTRACT_TAMEABLE_ANIMAL(ABSTRACT_ANIMAL, null),
CAT(ABSTRACT_TAMEABLE_ANIMAL),
OCELOT(ABSTRACT_TAMEABLE_ANIMAL),
WOLF(ABSTRACT_TAMEABLE_ANIMAL),
PARROT(ABSTRACT_TAMEABLE_ANIMAL),
ABSTRACT_HORSE(ABSTRACT_ANIMAL, null),
HORSE(ABSTRACT_HORSE),
SKELETON_HORSE(ABSTRACT_HORSE),
ZOMBIE_HORSE(ABSTRACT_HORSE),
CAMEL(ABSTRACT_HORSE),
CHESTED_HORSE(ABSTRACT_HORSE, null),
DONKEY(CHESTED_HORSE),
MULE(CHESTED_HORSE),
LLAMA(CHESTED_HORSE),
TRADER_LLAMA(LLAMA),
// Monsters // Monsters
ABSTRACT_MONSTER(ABSTRACT_CREATURE, null), ABSTRACT_MONSTER(ABSTRACT_CREATURE, null),
@ -127,112 +195,43 @@ public enum EntityTypes1_20_3 implements EntityType {
GIANT(ABSTRACT_MONSTER), GIANT(ABSTRACT_MONSTER),
SILVERFISH(ABSTRACT_MONSTER), SILVERFISH(ABSTRACT_MONSTER),
VEX(ABSTRACT_MONSTER), VEX(ABSTRACT_MONSTER),
WITCH(ABSTRACT_MONSTER),
WITHER(ABSTRACT_MONSTER), WITHER(ABSTRACT_MONSTER),
RAVAGER(ABSTRACT_MONSTER),
BREEZE(ABSTRACT_MONSTER), BREEZE(ABSTRACT_MONSTER),
ABSTRACT_PIGLIN(ABSTRACT_MONSTER, null),
PIGLIN(ABSTRACT_PIGLIN),
PIGLIN_BRUTE(ABSTRACT_PIGLIN),
HOGLIN(ABSTRACT_ANIMAL),
STRIDER(ABSTRACT_ANIMAL),
TADPOLE(ABSTRACT_FISHES),
ZOGLIN(ABSTRACT_MONSTER), ZOGLIN(ABSTRACT_MONSTER),
WARDEN(ABSTRACT_MONSTER), WARDEN(ABSTRACT_MONSTER),
// Illagers
ABSTRACT_ILLAGER_BASE(ABSTRACT_MONSTER, null),
ABSTRACT_EVO_ILLU_ILLAGER(ABSTRACT_ILLAGER_BASE, null),
EVOKER(ABSTRACT_EVO_ILLU_ILLAGER),
ILLUSIONER(ABSTRACT_EVO_ILLU_ILLAGER),
VINDICATOR(ABSTRACT_ILLAGER_BASE),
PILLAGER(ABSTRACT_ILLAGER_BASE),
// Skeletons
ABSTRACT_SKELETON(ABSTRACT_MONSTER, null), ABSTRACT_SKELETON(ABSTRACT_MONSTER, null),
SKELETON(ABSTRACT_SKELETON), SKELETON(ABSTRACT_SKELETON),
STRAY(ABSTRACT_SKELETON), STRAY(ABSTRACT_SKELETON),
WITHER_SKELETON(ABSTRACT_SKELETON), WITHER_SKELETON(ABSTRACT_SKELETON),
// Guardians
GUARDIAN(ABSTRACT_MONSTER),
ELDER_GUARDIAN(GUARDIAN),
// Spiders
SPIDER(ABSTRACT_MONSTER),
CAVE_SPIDER(SPIDER),
// Zombies
ZOMBIE(ABSTRACT_MONSTER), ZOMBIE(ABSTRACT_MONSTER),
DROWNED(ZOMBIE), DROWNED(ZOMBIE),
HUSK(ZOMBIE), HUSK(ZOMBIE),
ZOMBIFIED_PIGLIN(ZOMBIE), ZOMBIFIED_PIGLIN(ZOMBIE),
ZOMBIE_VILLAGER(ZOMBIE), ZOMBIE_VILLAGER(ZOMBIE),
// Flying entities GUARDIAN(ABSTRACT_MONSTER),
ABSTRACT_FLYING(ABSTRACT_INSENTIENT, null), ELDER_GUARDIAN(GUARDIAN),
GHAST(ABSTRACT_FLYING),
PHANTOM(ABSTRACT_FLYING),
ABSTRACT_AMBIENT(ABSTRACT_INSENTIENT, null), SPIDER(ABSTRACT_MONSTER),
BAT(ABSTRACT_AMBIENT), CAVE_SPIDER(SPIDER),
ALLAY(ABSTRACT_CREATURE),
ABSTRACT_WATERMOB(ABSTRACT_INSENTIENT, null), ABSTRACT_PIGLIN(ABSTRACT_MONSTER, null),
SQUID(ABSTRACT_WATERMOB), PIGLIN(ABSTRACT_PIGLIN),
GLOW_SQUID(SQUID), PIGLIN_BRUTE(ABSTRACT_PIGLIN),
// Slimes // Raiders
SLIME(ABSTRACT_INSENTIENT), ABSTRACT_RAIDER(ABSTRACT_MONSTER, null),
MAGMA_CUBE(SLIME), WITCH(ABSTRACT_RAIDER),
RAVAGER(ABSTRACT_RAIDER),
// Hangable objects ABSTRACT_ILLAGER_BASE(ABSTRACT_RAIDER, null),
ABSTRACT_HANGING(ENTITY, null), ABSTRACT_EVO_ILLU_ILLAGER(ABSTRACT_ILLAGER_BASE, null),
LEASH_KNOT(ABSTRACT_HANGING), VINDICATOR(ABSTRACT_ILLAGER_BASE),
ITEM_FRAME(ABSTRACT_HANGING), PILLAGER(ABSTRACT_ILLAGER_BASE),
GLOW_ITEM_FRAME(ITEM_FRAME), EVOKER(ABSTRACT_EVO_ILLU_ILLAGER),
PAINTING(ABSTRACT_HANGING), ILLUSIONER(ABSTRACT_EVO_ILLU_ILLAGER);
ABSTRACT_LIGHTNING(ENTITY, null),
LIGHTNING_BOLT(ABSTRACT_LIGHTNING),
// Arrows
ABSTRACT_ARROW(ENTITY, null),
ARROW(ABSTRACT_ARROW),
SPECTRAL_ARROW(ABSTRACT_ARROW),
TRIDENT(ABSTRACT_ARROW),
// Fireballs
ABSTRACT_FIREBALL(ENTITY, null),
DRAGON_FIREBALL(ABSTRACT_FIREBALL),
FIREBALL(ABSTRACT_FIREBALL),
SMALL_FIREBALL(ABSTRACT_FIREBALL),
WITHER_SKULL(ABSTRACT_FIREBALL),
// Projectiles
PROJECTILE_ABSTRACT(ENTITY, null),
SNOWBALL(PROJECTILE_ABSTRACT),
ENDER_PEARL(PROJECTILE_ABSTRACT),
EGG(PROJECTILE_ABSTRACT),
POTION(PROJECTILE_ABSTRACT),
EXPERIENCE_BOTTLE(PROJECTILE_ABSTRACT),
WIND_CHARGE(PROJECTILE_ABSTRACT),
// Vehicles
MINECART_ABSTRACT(ENTITY, null),
CHESTED_MINECART_ABSTRACT(MINECART_ABSTRACT, null),
CHEST_MINECART(CHESTED_MINECART_ABSTRACT),
HOPPER_MINECART(CHESTED_MINECART_ABSTRACT),
MINECART(MINECART_ABSTRACT),
FURNACE_MINECART(MINECART_ABSTRACT),
COMMAND_BLOCK_MINECART(MINECART_ABSTRACT),
TNT_MINECART(MINECART_ABSTRACT),
SPAWNER_MINECART(MINECART_ABSTRACT),
BOAT(ENTITY),
CHEST_BOAT(BOAT);
private static final EntityType[] TYPES = EntityTypeUtil.createSizedArray(values()); private static final EntityType[] TYPES = EntityTypeUtil.createSizedArray(values());
private final EntityType parent; private final EntityType parent;

Datei anzeigen

@ -38,89 +38,159 @@ public enum EntityTypes1_20_5 implements EntityType {
EXPERIENCE_ORB(ENTITY), EXPERIENCE_ORB(ENTITY),
EYE_OF_ENDER(ENTITY), EYE_OF_ENDER(ENTITY),
FALLING_BLOCK(ENTITY), FALLING_BLOCK(ENTITY),
FIREWORK_ROCKET(PROJECTILE_ABSTRACT),
ITEM(ENTITY), ITEM(ENTITY),
LLAMA_SPIT(PROJECTILE_ABSTRACT),
TNT(ENTITY), TNT(ENTITY),
SHULKER_BULLET(PROJECTILE_ABSTRACT),
FISHING_BOBBER(PROJECTILE_ABSTRACT),
OMINOUS_ITEM_SPAWNER(ENTITY), OMINOUS_ITEM_SPAWNER(ENTITY),
LIVINGENTITY(ENTITY, null),
ARMOR_STAND(LIVINGENTITY),
MARKER(ENTITY), MARKER(ENTITY),
PLAYER(LIVINGENTITY), LIGHTNING_BOLT(ENTITY),
INTERACTION(ENTITY),
DISPLAY(ENTITY, null), DISPLAY(ENTITY, null),
BLOCK_DISPLAY(DISPLAY), BLOCK_DISPLAY(DISPLAY),
ITEM_DISPLAY(DISPLAY), ITEM_DISPLAY(DISPLAY),
TEXT_DISPLAY(DISPLAY), TEXT_DISPLAY(DISPLAY),
INTERACTION(ENTITY),
// Hanging entities
ABSTRACT_HANGING(ENTITY, null),
LEASH_KNOT(ABSTRACT_HANGING),
PAINTING(ABSTRACT_HANGING),
ITEM_FRAME(ABSTRACT_HANGING),
GLOW_ITEM_FRAME(ITEM_FRAME),
// Projectiles
PROJECTILE_ABSTRACT(ENTITY, null), // Not actually its own abstract type, but useful for categorizing
SNOWBALL(PROJECTILE_ABSTRACT),
ENDER_PEARL(PROJECTILE_ABSTRACT),
EGG(PROJECTILE_ABSTRACT),
POTION(PROJECTILE_ABSTRACT),
EXPERIENCE_BOTTLE(PROJECTILE_ABSTRACT),
FIREWORK_ROCKET(PROJECTILE_ABSTRACT),
LLAMA_SPIT(PROJECTILE_ABSTRACT),
SHULKER_BULLET(PROJECTILE_ABSTRACT),
FISHING_BOBBER(PROJECTILE_ABSTRACT),
WITHER_SKULL(PROJECTILE_ABSTRACT),
DRAGON_FIREBALL(PROJECTILE_ABSTRACT), // Doesn't actually inherit fireball
ABSTRACT_ARROW(PROJECTILE_ABSTRACT, null),
ARROW(ABSTRACT_ARROW),
SPECTRAL_ARROW(ABSTRACT_ARROW),
TRIDENT(ABSTRACT_ARROW),
ABSTRACT_FIREBALL(ENTITY, null),
FIREBALL(ABSTRACT_FIREBALL),
SMALL_FIREBALL(ABSTRACT_FIREBALL),
ABSTRACT_WIND_CHARGE(PROJECTILE_ABSTRACT, null),
WIND_CHARGE(ABSTRACT_WIND_CHARGE),
BREEZE_WIND_CHARGE(ABSTRACT_WIND_CHARGE),
// Vehicles
VEHICLE(ENTITY, null),
BOAT(VEHICLE),
MINECART_ABSTRACT(VEHICLE, null),
MINECART(MINECART_ABSTRACT),
FURNACE_MINECART(MINECART_ABSTRACT),
COMMAND_BLOCK_MINECART(MINECART_ABSTRACT),
TNT_MINECART(MINECART_ABSTRACT),
SPAWNER_MINECART(MINECART_ABSTRACT),
CHEST_BOAT(BOAT),
CHESTED_MINECART_ABSTRACT(MINECART_ABSTRACT, null),
CHEST_MINECART(CHESTED_MINECART_ABSTRACT),
HOPPER_MINECART(CHESTED_MINECART_ABSTRACT),
// Living entities as a larger subclass
LIVINGENTITY(ENTITY, null),
ARMOR_STAND(LIVINGENTITY),
PLAYER(LIVINGENTITY),
// Mobs as a larger subclass
ABSTRACT_INSENTIENT(LIVINGENTITY, null), ABSTRACT_INSENTIENT(LIVINGENTITY, null),
ENDER_DRAGON(ABSTRACT_INSENTIENT), ENDER_DRAGON(ABSTRACT_INSENTIENT),
BEE(ABSTRACT_ANIMAL), SLIME(ABSTRACT_INSENTIENT),
MAGMA_CUBE(SLIME),
// Ambient mobs
ABSTRACT_AMBIENT(ABSTRACT_INSENTIENT, null),
BAT(ABSTRACT_AMBIENT),
// Flying mobs
ABSTRACT_FLYING(ABSTRACT_INSENTIENT, null),
GHAST(ABSTRACT_FLYING),
PHANTOM(ABSTRACT_FLYING),
// Pathfinder mobs and its subclasses
ABSTRACT_CREATURE(ABSTRACT_INSENTIENT, null), ABSTRACT_CREATURE(ABSTRACT_INSENTIENT, null),
ALLAY(ABSTRACT_CREATURE),
ABSTRACT_AGEABLE(ABSTRACT_CREATURE, null),
ABSTRACT_VILLAGER(ABSTRACT_AGEABLE, null),
VILLAGER(ABSTRACT_VILLAGER),
WANDERING_TRADER(ABSTRACT_VILLAGER),
// Animals
ABSTRACT_ANIMAL(ABSTRACT_AGEABLE, null),
AXOLOTL(ABSTRACT_ANIMAL),
DOLPHIN(ABSTRACT_WATERMOB),
CHICKEN(ABSTRACT_ANIMAL),
COW(ABSTRACT_ANIMAL),
MOOSHROOM(COW),
PANDA(ABSTRACT_ANIMAL),
PIG(ABSTRACT_ANIMAL),
POLAR_BEAR(ABSTRACT_ANIMAL),
RABBIT(ABSTRACT_ANIMAL),
SHEEP(ABSTRACT_ANIMAL),
TURTLE(ABSTRACT_ANIMAL),
FOX(ABSTRACT_ANIMAL),
FROG(ABSTRACT_ANIMAL),
GOAT(ABSTRACT_ANIMAL),
SNIFFER(ABSTRACT_ANIMAL),
ARMADILLO(ABSTRACT_ANIMAL),
ABSTRACT_TAMEABLE_ANIMAL(ABSTRACT_ANIMAL, null),
CAT(ABSTRACT_TAMEABLE_ANIMAL),
OCELOT(ABSTRACT_TAMEABLE_ANIMAL),
WOLF(ABSTRACT_TAMEABLE_ANIMAL),
PARROT(ABSTRACT_TAMEABLE_ANIMAL),
// Horses
ABSTRACT_HORSE(ABSTRACT_ANIMAL, null),
CHESTED_HORSE(ABSTRACT_HORSE, null),
DONKEY(CHESTED_HORSE),
MULE(CHESTED_HORSE),
LLAMA(CHESTED_HORSE),
TRADER_LLAMA(LLAMA),
HORSE(ABSTRACT_HORSE),
SKELETON_HORSE(ABSTRACT_HORSE),
ZOMBIE_HORSE(ABSTRACT_HORSE),
CAMEL(ABSTRACT_HORSE),
// Golem
ABSTRACT_GOLEM(ABSTRACT_CREATURE, null), ABSTRACT_GOLEM(ABSTRACT_CREATURE, null),
SNOW_GOLEM(ABSTRACT_GOLEM), SNOW_GOLEM(ABSTRACT_GOLEM),
IRON_GOLEM(ABSTRACT_GOLEM), IRON_GOLEM(ABSTRACT_GOLEM),
SHULKER(ABSTRACT_GOLEM), SHULKER(ABSTRACT_GOLEM),
// Fish // Water mobs
ABSTRACT_WATERMOB(ABSTRACT_CREATURE, null),
DOLPHIN(ABSTRACT_WATERMOB),
SQUID(ABSTRACT_WATERMOB),
GLOW_SQUID(SQUID),
ABSTRACT_FISHES(ABSTRACT_WATERMOB, null), ABSTRACT_FISHES(ABSTRACT_WATERMOB, null),
PUFFERFISH(ABSTRACT_FISHES),
TADPOLE(ABSTRACT_FISHES),
ABSTRACT_SCHOOLING_FISH(ABSTRACT_FISHES, null), ABSTRACT_SCHOOLING_FISH(ABSTRACT_FISHES, null),
COD(ABSTRACT_SCHOOLING_FISH), COD(ABSTRACT_SCHOOLING_FISH),
PUFFERFISH(ABSTRACT_FISHES),
SALMON(ABSTRACT_SCHOOLING_FISH), SALMON(ABSTRACT_SCHOOLING_FISH),
TROPICAL_FISH(ABSTRACT_SCHOOLING_FISH), TROPICAL_FISH(ABSTRACT_SCHOOLING_FISH),
// Ageable mobs and (tamable) animals
ABSTRACT_AGEABLE(ABSTRACT_CREATURE, null),
ABSTRACT_VILLAGER(ABSTRACT_AGEABLE, null),
VILLAGER(ABSTRACT_VILLAGER),
WANDERING_TRADER(ABSTRACT_VILLAGER),
ABSTRACT_ANIMAL(ABSTRACT_AGEABLE, null),
AXOLOTL(ABSTRACT_ANIMAL),
CHICKEN(ABSTRACT_ANIMAL),
PANDA(ABSTRACT_ANIMAL),
PIG(ABSTRACT_ANIMAL),
POLAR_BEAR(ABSTRACT_ANIMAL),
RABBIT(ABSTRACT_ANIMAL),
SHEEP(ABSTRACT_ANIMAL),
BEE(ABSTRACT_ANIMAL),
TURTLE(ABSTRACT_ANIMAL),
FOX(ABSTRACT_ANIMAL),
FROG(ABSTRACT_ANIMAL),
GOAT(ABSTRACT_ANIMAL),
HOGLIN(ABSTRACT_ANIMAL),
STRIDER(ABSTRACT_ANIMAL),
SNIFFER(ABSTRACT_ANIMAL),
ARMADILLO(ABSTRACT_ANIMAL),
COW(ABSTRACT_ANIMAL),
MOOSHROOM(COW),
ABSTRACT_TAMEABLE_ANIMAL(ABSTRACT_ANIMAL, null),
CAT(ABSTRACT_TAMEABLE_ANIMAL),
OCELOT(ABSTRACT_TAMEABLE_ANIMAL),
WOLF(ABSTRACT_TAMEABLE_ANIMAL),
PARROT(ABSTRACT_TAMEABLE_ANIMAL),
ABSTRACT_HORSE(ABSTRACT_ANIMAL, null),
HORSE(ABSTRACT_HORSE),
SKELETON_HORSE(ABSTRACT_HORSE),
ZOMBIE_HORSE(ABSTRACT_HORSE),
CAMEL(ABSTRACT_HORSE),
CHESTED_HORSE(ABSTRACT_HORSE, null),
DONKEY(CHESTED_HORSE),
MULE(CHESTED_HORSE),
LLAMA(CHESTED_HORSE),
TRADER_LLAMA(LLAMA),
// Monsters // Monsters
ABSTRACT_MONSTER(ABSTRACT_CREATURE, null), ABSTRACT_MONSTER(ABSTRACT_CREATURE, null),
BLAZE(ABSTRACT_MONSTER), BLAZE(ABSTRACT_MONSTER),
@ -130,117 +200,44 @@ public enum EntityTypes1_20_5 implements EntityType {
GIANT(ABSTRACT_MONSTER), GIANT(ABSTRACT_MONSTER),
SILVERFISH(ABSTRACT_MONSTER), SILVERFISH(ABSTRACT_MONSTER),
VEX(ABSTRACT_MONSTER), VEX(ABSTRACT_MONSTER),
WITCH(ABSTRACT_RAIDER),
WITHER(ABSTRACT_MONSTER), WITHER(ABSTRACT_MONSTER),
RAVAGER(ABSTRACT_RAIDER),
BREEZE(ABSTRACT_MONSTER), BREEZE(ABSTRACT_MONSTER),
ABSTRACT_PIGLIN(ABSTRACT_MONSTER, null),
PIGLIN(ABSTRACT_PIGLIN),
PIGLIN_BRUTE(ABSTRACT_PIGLIN),
HOGLIN(ABSTRACT_ANIMAL),
STRIDER(ABSTRACT_ANIMAL),
TADPOLE(ABSTRACT_FISHES),
ZOGLIN(ABSTRACT_MONSTER), ZOGLIN(ABSTRACT_MONSTER),
WARDEN(ABSTRACT_MONSTER), WARDEN(ABSTRACT_MONSTER),
// Illagers
ABSTRACT_RAIDER(ABSTRACT_MONSTER, null),
ABSTRACT_ILLAGER_BASE(ABSTRACT_RAIDER, null),
ABSTRACT_EVO_ILLU_ILLAGER(ABSTRACT_ILLAGER_BASE, null),
EVOKER(ABSTRACT_EVO_ILLU_ILLAGER),
ILLUSIONER(ABSTRACT_EVO_ILLU_ILLAGER),
VINDICATOR(ABSTRACT_ILLAGER_BASE),
PILLAGER(ABSTRACT_ILLAGER_BASE),
// Skeletons
ABSTRACT_SKELETON(ABSTRACT_MONSTER, null), ABSTRACT_SKELETON(ABSTRACT_MONSTER, null),
SKELETON(ABSTRACT_SKELETON), SKELETON(ABSTRACT_SKELETON),
STRAY(ABSTRACT_SKELETON), STRAY(ABSTRACT_SKELETON),
WITHER_SKELETON(ABSTRACT_SKELETON), WITHER_SKELETON(ABSTRACT_SKELETON),
BOGGED(ABSTRACT_SKELETON), BOGGED(ABSTRACT_SKELETON),
// Guardians
GUARDIAN(ABSTRACT_MONSTER),
ELDER_GUARDIAN(GUARDIAN),
// Spiders
SPIDER(ABSTRACT_MONSTER),
CAVE_SPIDER(SPIDER),
// Zombies
ZOMBIE(ABSTRACT_MONSTER), ZOMBIE(ABSTRACT_MONSTER),
DROWNED(ZOMBIE), DROWNED(ZOMBIE),
HUSK(ZOMBIE), HUSK(ZOMBIE),
ZOMBIFIED_PIGLIN(ZOMBIE), ZOMBIFIED_PIGLIN(ZOMBIE),
ZOMBIE_VILLAGER(ZOMBIE), ZOMBIE_VILLAGER(ZOMBIE),
// Flying entities GUARDIAN(ABSTRACT_MONSTER),
ABSTRACT_FLYING(ABSTRACT_INSENTIENT, null), ELDER_GUARDIAN(GUARDIAN),
GHAST(ABSTRACT_FLYING),
PHANTOM(ABSTRACT_FLYING),
ABSTRACT_AMBIENT(ABSTRACT_INSENTIENT, null), SPIDER(ABSTRACT_MONSTER),
BAT(ABSTRACT_AMBIENT), CAVE_SPIDER(SPIDER),
ALLAY(ABSTRACT_CREATURE),
ABSTRACT_WATERMOB(ABSTRACT_CREATURE, null), ABSTRACT_PIGLIN(ABSTRACT_MONSTER, null),
SQUID(ABSTRACT_WATERMOB), PIGLIN(ABSTRACT_PIGLIN),
GLOW_SQUID(SQUID), PIGLIN_BRUTE(ABSTRACT_PIGLIN),
// Slimes // Raiders
SLIME(ABSTRACT_INSENTIENT), ABSTRACT_RAIDER(ABSTRACT_MONSTER, null),
MAGMA_CUBE(SLIME), WITCH(ABSTRACT_RAIDER),
RAVAGER(ABSTRACT_RAIDER),
// Hangable objects ABSTRACT_ILLAGER_BASE(ABSTRACT_RAIDER, null),
ABSTRACT_HANGING(ENTITY, null), ABSTRACT_EVO_ILLU_ILLAGER(ABSTRACT_ILLAGER_BASE, null),
LEASH_KNOT(ABSTRACT_HANGING), VINDICATOR(ABSTRACT_ILLAGER_BASE),
ITEM_FRAME(ABSTRACT_HANGING), PILLAGER(ABSTRACT_ILLAGER_BASE),
GLOW_ITEM_FRAME(ITEM_FRAME), EVOKER(ABSTRACT_EVO_ILLU_ILLAGER),
PAINTING(ABSTRACT_HANGING), ILLUSIONER(ABSTRACT_EVO_ILLU_ILLAGER);
ABSTRACT_LIGHTNING(ENTITY, null),
LIGHTNING_BOLT(ABSTRACT_LIGHTNING),
// Arrows
ABSTRACT_ARROW(PROJECTILE_ABSTRACT, null),
ARROW(ABSTRACT_ARROW),
SPECTRAL_ARROW(ABSTRACT_ARROW),
TRIDENT(ABSTRACT_ARROW),
// Fireballs
ABSTRACT_FIREBALL(ENTITY, null),
DRAGON_FIREBALL(PROJECTILE_ABSTRACT),
FIREBALL(ABSTRACT_FIREBALL),
SMALL_FIREBALL(ABSTRACT_FIREBALL),
WITHER_SKULL(PROJECTILE_ABSTRACT),
// Projectiles
PROJECTILE_ABSTRACT(ENTITY, null), // Not actually its own abstract type, but useful for categorizing
SNOWBALL(PROJECTILE_ABSTRACT),
ENDER_PEARL(PROJECTILE_ABSTRACT),
EGG(PROJECTILE_ABSTRACT),
POTION(PROJECTILE_ABSTRACT),
EXPERIENCE_BOTTLE(PROJECTILE_ABSTRACT),
ABSTRACT_WIND_CHARGE(PROJECTILE_ABSTRACT, null),
WIND_CHARGE(ABSTRACT_WIND_CHARGE),
BREEZE_WIND_CHARGE(ABSTRACT_WIND_CHARGE),
// Vehicles
VEHICLE(ENTITY, null),
MINECART_ABSTRACT(VEHICLE, null),
CHESTED_MINECART_ABSTRACT(MINECART_ABSTRACT, null),
CHEST_MINECART(CHESTED_MINECART_ABSTRACT),
HOPPER_MINECART(CHESTED_MINECART_ABSTRACT),
MINECART(MINECART_ABSTRACT),
FURNACE_MINECART(MINECART_ABSTRACT),
COMMAND_BLOCK_MINECART(MINECART_ABSTRACT),
TNT_MINECART(MINECART_ABSTRACT),
SPAWNER_MINECART(MINECART_ABSTRACT),
BOAT(VEHICLE),
CHEST_BOAT(BOAT);
private static final EntityType[] TYPES = EntityTypeUtil.createSizedArray(values()); private static final EntityType[] TYPES = EntityTypeUtil.createSizedArray(values());
private final EntityType parent; private final EntityType parent;

Datei anzeigen

@ -24,6 +24,7 @@ package com.viaversion.viaversion.util;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.data.FullMappings;
import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.protocol.Protocol; import com.viaversion.viaversion.api.protocol.Protocol;
import java.util.ArrayList; import java.util.ArrayList;
@ -62,16 +63,21 @@ public final class EntityTypeUtil {
* @param <T> entity type * @param <T> entity type
*/ */
public static <T extends EntityType> void initialize(final T[] values, final EntityType[] typesToFill, final Protocol<?, ?, ?, ?> protocol, final EntityIdSetter<T> idSetter) { public static <T extends EntityType> void initialize(final T[] values, final EntityType[] typesToFill, final Protocol<?, ?, ?, ?> protocol, final EntityIdSetter<T> idSetter) {
final FullMappings mappings = protocol.getMappingData().getEntityMappings();
for (final T type : values) { for (final T type : values) {
if (type.isAbstractType()) { if (type.isAbstractType()) {
continue; continue;
} }
final int id = protocol.getMappingData().getEntityMappings().mappedId(type.identifier()); final int id = mappings.mappedId(type.identifier());
Preconditions.checkArgument(id != -1, "Entity type %s has no id", type.identifier()); Preconditions.checkArgument(id != -1, "Entity type %s has no id", type.identifier());
idSetter.setId(type, id); idSetter.setId(type, id);
typesToFill[id] = type; typesToFill[id] = type;
} }
if (typesToFill.length != mappings.mappedSize()) {
throw new IllegalArgumentException("typesToFill length doesn't match the amount of entity types: " + typesToFill.length + " != " + mappings.size());
}
} }
public static EntityType[] createSizedArray(final EntityType[] values) { public static EntityType[] createSizedArray(final EntityType[] values) {

Datei anzeigen

@ -19,6 +19,7 @@ package com.viaversion.viaversion.protocols.protocol1_14to1_13_2;
import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.ClientWorld; import com.viaversion.viaversion.api.minecraft.ClientWorld;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_14;
import com.viaversion.viaversion.api.protocol.AbstractProtocol; import com.viaversion.viaversion.api.protocol.AbstractProtocol;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.misc.ParticleType; import com.viaversion.viaversion.api.type.types.misc.ParticleType;
@ -145,6 +146,7 @@ public class Protocol1_14To1_13_2 extends AbstractProtocol<ClientboundPackets1_1
WorldPackets.voidAir = MAPPINGS.getBlockStateMappings().getNewId(8591); WorldPackets.voidAir = MAPPINGS.getBlockStateMappings().getNewId(8591);
WorldPackets.caveAir = MAPPINGS.getBlockStateMappings().getNewId(8592); WorldPackets.caveAir = MAPPINGS.getBlockStateMappings().getNewId(8592);
EntityTypes1_14.initialize(this);
Types1_13_2.PARTICLE.filler(this, false) Types1_13_2.PARTICLE.filler(this, false)
.reader("block", ParticleType.Readers.BLOCK) .reader("block", ParticleType.Readers.BLOCK)
.reader("dust", ParticleType.Readers.DUST) .reader("dust", ParticleType.Readers.DUST)

Datei anzeigen

@ -38,13 +38,6 @@ public class MetadataRewriter1_14To1_13_2 extends EntityRewriter<ClientboundPack
public MetadataRewriter1_14To1_13_2(Protocol1_14To1_13_2 protocol) { public MetadataRewriter1_14To1_13_2(Protocol1_14To1_13_2 protocol) {
super(protocol); super(protocol);
mapTypes(EntityTypes1_13.EntityType.values(), EntityTypes1_14.class);
if (Via.getConfig().translateOcelotToCat()) {
// A better solution for this would be to despawn the ocelot and spawn a cat in its place, but that would
// require a lot of data tracking and is not worth the effort.
mapEntityType(EntityTypes1_13.EntityType.OCELOT, EntityTypes1_14.CAT);
}
} }
@Override @Override
@ -184,6 +177,16 @@ public class MetadataRewriter1_14To1_13_2 extends EntityRewriter<ClientboundPack
}); });
} }
@Override
public void onMappingDataLoaded() {
mapTypes();
if (Via.getConfig().translateOcelotToCat()) {
// A better solution for this would be to despawn the ocelot and spawn a cat in its place, but that would
// require a lot of data tracking and is not worth the effort.
mapEntityType(EntityTypes1_13.EntityType.OCELOT, EntityTypes1_14.CAT);
}
}
@Override @Override
public EntityType typeFromId(int type) { public EntityType typeFromId(int type) {
return EntityTypes1_14.getTypeFromId(type); return EntityTypes1_14.getTypeFromId(type);

Datei anzeigen

@ -68,6 +68,8 @@ public class Protocol1_15To1_14_4 extends AbstractProtocol<ClientboundPackets1_1
protected void onMappingDataLoaded() { protected void onMappingDataLoaded() {
super.onMappingDataLoaded(); super.onMappingDataLoaded();
EntityTypes1_15.initialize(this);
int[] shulkerBoxes = new int[17]; int[] shulkerBoxes = new int[17];
int shulkerBoxOffset = 501; int shulkerBoxOffset = 501;
for (int i = 0; i < 17; i++) { for (int i = 0; i < 17; i++) {

Datei anzeigen

@ -86,6 +86,8 @@ public class Protocol1_16_2To1_16_1 extends AbstractProtocol<ClientboundPackets1
protected void onMappingDataLoaded() { protected void onMappingDataLoaded() {
super.onMappingDataLoaded(); super.onMappingDataLoaded();
EntityTypes1_16_2.initialize(this);
tagRewriter.addTag(RegistryType.ITEM, "minecraft:stone_crafting_materials", 14, 962); tagRewriter.addTag(RegistryType.ITEM, "minecraft:stone_crafting_materials", 14, 962);
tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:mushroom_grow_block"); tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:mushroom_grow_block");

Datei anzeigen

@ -18,7 +18,6 @@
package com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.metadata; package com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.metadata;
import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_16;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_16_2; import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_16_2;
import com.viaversion.viaversion.api.type.types.version.Types1_16; import com.viaversion.viaversion.api.type.types.version.Types1_16;
import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.Protocol1_16_2To1_16_1; import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.Protocol1_16_2To1_16_1;
@ -29,7 +28,6 @@ public class MetadataRewriter1_16_2To1_16_1 extends EntityRewriter<ClientboundPa
public MetadataRewriter1_16_2To1_16_1(Protocol1_16_2To1_16_1 protocol) { public MetadataRewriter1_16_2To1_16_1(Protocol1_16_2To1_16_1 protocol) {
super(protocol); super(protocol);
mapTypes(EntityTypes1_16.values(), EntityTypes1_16_2.class);
} }
@Override @Override
@ -48,6 +46,11 @@ public class MetadataRewriter1_16_2To1_16_1 extends EntityRewriter<ClientboundPa
}); });
} }
@Override
public void onMappingDataLoaded() {
mapTypes();
}
@Override @Override
public EntityType typeFromId(int type) { public EntityType typeFromId(int type) {
return EntityTypes1_16_2.getTypeFromId(type); return EntityTypes1_16_2.getTypeFromId(type);

Datei anzeigen

@ -257,6 +257,7 @@ public class Protocol1_16To1_15_2 extends AbstractProtocol<ClientboundPackets1_1
tagRewriter.addEmptyTags(RegistryType.ITEM, "minecraft:beds", "minecraft:coals", "minecraft:fences", "minecraft:flowers", tagRewriter.addEmptyTags(RegistryType.ITEM, "minecraft:beds", "minecraft:coals", "minecraft:fences", "minecraft:flowers",
"minecraft:lectern_books", "minecraft:music_discs", "minecraft:small_flowers", "minecraft:tall_flowers", "minecraft:trapdoors", "minecraft:walls", "minecraft:wooden_fences"); "minecraft:lectern_books", "minecraft:music_discs", "minecraft:small_flowers", "minecraft:tall_flowers", "minecraft:trapdoors", "minecraft:walls", "minecraft:wooden_fences");
EntityTypes1_16.initialize(this);
Types1_16.PARTICLE.filler(this) Types1_16.PARTICLE.filler(this)
.reader("block", ParticleType.Readers.BLOCK) .reader("block", ParticleType.Readers.BLOCK)
.reader("dust", ParticleType.Readers.DUST) .reader("dust", ParticleType.Readers.DUST)

Datei anzeigen

@ -18,7 +18,6 @@
package com.viaversion.viaversion.protocols.protocol1_16to1_15_2.metadata; package com.viaversion.viaversion.protocols.protocol1_16to1_15_2.metadata;
import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_15;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_16; import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_16;
import com.viaversion.viaversion.api.minecraft.metadata.Metadata; import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
import com.viaversion.viaversion.api.type.types.version.Types1_16; import com.viaversion.viaversion.api.type.types.version.Types1_16;
@ -30,8 +29,6 @@ public class MetadataRewriter1_16To1_15_2 extends EntityRewriter<ClientboundPack
public MetadataRewriter1_16To1_15_2(Protocol1_16To1_15_2 protocol) { public MetadataRewriter1_16To1_15_2(Protocol1_16To1_15_2 protocol) {
super(protocol); super(protocol);
mapEntityType(EntityTypes1_15.ZOMBIE_PIGMAN, EntityTypes1_16.ZOMBIFIED_PIGLIN);
mapTypes(EntityTypes1_15.values(), EntityTypes1_16.class);
} }
@Override @Override
@ -50,6 +47,11 @@ public class MetadataRewriter1_16To1_15_2 extends EntityRewriter<ClientboundPack
}); });
} }
@Override
public void onMappingDataLoaded() {
mapTypes();
}
@Override @Override
public EntityType typeFromId(int type) { public EntityType typeFromId(int type) {
return EntityTypes1_16.getTypeFromId(type); return EntityTypes1_16.getTypeFromId(type);

Datei anzeigen

@ -203,6 +203,7 @@ public final class Protocol1_17To1_16_4 extends AbstractProtocol<ClientboundPack
tagRewriter.addEmptyTags(RegistryType.ENTITY, "minecraft:powder_snow_walkable_mobs", "minecraft:axolotl_always_hostiles", "minecraft:axolotl_tempted_hostiles", tagRewriter.addEmptyTags(RegistryType.ENTITY, "minecraft:powder_snow_walkable_mobs", "minecraft:axolotl_always_hostiles", "minecraft:axolotl_tempted_hostiles",
"minecraft:axolotl_hunt_targets", "minecraft:freeze_hurts_extra_types", "minecraft:freeze_immune_entity_types"); "minecraft:axolotl_hunt_targets", "minecraft:freeze_hurts_extra_types", "minecraft:freeze_immune_entity_types");
EntityTypes1_17.initialize(this);
Types1_17.PARTICLE.filler(this) Types1_17.PARTICLE.filler(this)
.reader("block", ParticleType.Readers.BLOCK) .reader("block", ParticleType.Readers.BLOCK)
.reader("dust", ParticleType.Readers.DUST) .reader("dust", ParticleType.Readers.DUST)

Datei anzeigen

@ -22,7 +22,6 @@ import com.github.steveice10.opennbt.tag.builtin.IntTag;
import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.github.steveice10.opennbt.tag.builtin.ListTag;
import com.viaversion.viaversion.api.data.entity.EntityTracker; import com.viaversion.viaversion.api.data.entity.EntityTracker;
import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_16_2;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_17; import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_17;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType; import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
@ -40,7 +39,6 @@ public final class EntityPackets extends EntityRewriter<ClientboundPackets1_16_2
public EntityPackets(Protocol1_17To1_16_4 protocol) { public EntityPackets(Protocol1_17To1_16_4 protocol) {
super(protocol); super(protocol);
mapTypes(EntityTypes1_16_2.values(), EntityTypes1_17.class);
} }
@Override @Override
@ -174,6 +172,11 @@ public final class EntityPackets extends EntityRewriter<ClientboundPackets1_16_2
filter().type(EntityTypes1_17.SHULKER).removeIndex(17); filter().type(EntityTypes1_17.SHULKER).removeIndex(17);
} }
@Override
public void onMappingDataLoaded() {
mapTypes();
}
@Override @Override
public EntityType typeFromId(int type) { public EntityType typeFromId(int type) {
return EntityTypes1_17.getTypeFromId(type); return EntityTypes1_17.getTypeFromId(type);

Datei anzeigen

@ -170,30 +170,6 @@ public abstract class EntityRewriter<C extends ClientboundPacketType, T extends
typeMappings.setNewId(id, mappedId); typeMappings.setNewId(id, mappedId);
} }
/**
* Maps entity ids based on the enum constant's names.
*
* @param oldTypes entity types of the higher version
* @param newTypeClass entity types enum class of the lower version
* @param <E> new enum entity type
*/
public <E extends Enum<E> & EntityType> void mapTypes(EntityType[] oldTypes, Class<E> newTypeClass) {
if (typeMappings == null) {
typeMappings = Int2IntMapMappings.of();
}
for (EntityType oldType : oldTypes) {
try {
E newType = Enum.valueOf(newTypeClass, oldType.name());
typeMappings.setNewId(oldType.getId(), newType.getId());
} catch (IllegalArgumentException notFound) {
if (!typeMappings.contains(oldType.getId())) {
Via.getPlatform().getLogger().warning("Could not find new entity type for " + oldType + "! " +
"Old type: " + oldType.getClass().getEnclosingClass().getSimpleName() + ", new type: " + newTypeClass.getEnclosingClass().getSimpleName());
}
}
}
}
/** /**
* Maps entity ids based on the protocol's mapping data. * Maps entity ids based on the protocol's mapping data.
*/ */

Datei anzeigen

@ -1,52 +0,0 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viaversion.common.entities;
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_14;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_15;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_16;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_16_2;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_17;
import java.util.function.Function;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
* Test to make sure the array storage approach of entity types works correctly.
*/
public class EntityTypesTest {
@Test
void testArrayOrder() {
testArrayOrder(EntityTypes1_14.values(), EntityTypes1_14::getTypeFromId);
testArrayOrder(EntityTypes1_15.values(), EntityTypes1_15::getTypeFromId);
testArrayOrder(EntityTypes1_16.values(), EntityTypes1_16::getTypeFromId);
testArrayOrder(EntityTypes1_16_2.values(), EntityTypes1_16_2::getTypeFromId);
testArrayOrder(EntityTypes1_17.values(), EntityTypes1_17::getTypeFromId);
// Newer type enums are automatically filled using mappings
}
private void testArrayOrder(EntityType[] types, Function<Integer, EntityType> returnFunction) {
for (EntityType type : types) {
if (type.getId() != -1) {
Assertions.assertEquals(type, returnFunction.apply(type.getId()));
}
}
}
}