Use a single registry-impl class per type

This commit is contained in:
TheMode 2021-07-30 15:08:06 +02:00
parent 1baf4a5068
commit 3dd35c1605
35 changed files with 3224 additions and 3380 deletions

View File

@ -18,14 +18,14 @@ public class Generators {
File outputFolder = new File(args[0]);
var generator = new CodeGenerator(outputFolder);
generator.generate(resource("blocks.json"), "net.minestom.server.instance.block", "Block", "BlockLoader", "BlockConstants");
generator.generate(resource("items.json"), "net.minestom.server.item", "Material", "MaterialLoader", "MaterialConstants");
generator.generate(resource("entities.json"), "net.minestom.server.entity", "EntityType", "EntityTypeLoader", "EntityTypeConstants");
generator.generate(resource("enchantments.json"), "net.minestom.server.item", "Enchantment", "EnchantmentLoader", "EnchantmentConstants");
generator.generate(resource("potion_effects.json"), "net.minestom.server.potion", "PotionEffect", "PotionEffectLoader", "PotionEffectConstants");
generator.generate(resource("potions.json"), "net.minestom.server.potion", "PotionType", "PotionTypeLoader", "PotionTypeConstants");
generator.generate(resource("particles.json"), "net.minestom.server.particle", "Particle", "ParticleLoader", "ParticleConstants");
generator.generate(resource("sounds.json"), "net.minestom.server.sound", "SoundEvent", "SoundEventLoader", "SoundEventConstants");
generator.generate(resource("custom_statistics.json"), "net.minestom.server.statistic", "StatisticType", "StatisticTypeLoader", "StatisticTypeConstants");
generator.generate(resource("items.json"), "net.minestom.server.item", "Material", "MaterialImpl", "MaterialConstants");
generator.generate(resource("entities.json"), "net.minestom.server.entity", "EntityType", "EntityTypeImpl", "EntityTypeConstants");
generator.generate(resource("enchantments.json"), "net.minestom.server.item", "Enchantment", "EnchantmentImpl", "EnchantmentConstants");
generator.generate(resource("potion_effects.json"), "net.minestom.server.potion", "PotionEffect", "PotionEffectImpl", "PotionEffectConstants");
generator.generate(resource("potions.json"), "net.minestom.server.potion", "PotionType", "PotionTypeImpl", "PotionTypeConstants");
generator.generate(resource("particles.json"), "net.minestom.server.particle", "Particle", "ParticleImpl", "ParticleConstants");
generator.generate(resource("sounds.json"), "net.minestom.server.sound", "SoundEvent", "SoundEventImpl", "SoundEventConstants");
generator.generate(resource("custom_statistics.json"), "net.minestom.server.statistic", "StatisticType", "StatisticTypeImpl", "StatisticTypeConstants");
// Generate fluids
new FluidGenerator(resource("fluids.json"), outputFolder).generate();

View File

@ -5,229 +5,229 @@ package net.minestom.server.entity;
*/
@SuppressWarnings("unused")
interface EntityTypeConstants {
EntityType AREA_EFFECT_CLOUD = EntityTypeLoader.get("minecraft:area_effect_cloud");
EntityType AREA_EFFECT_CLOUD = EntityTypeImpl.get("minecraft:area_effect_cloud");
EntityType ARMOR_STAND = EntityTypeLoader.get("minecraft:armor_stand");
EntityType ARMOR_STAND = EntityTypeImpl.get("minecraft:armor_stand");
EntityType ARROW = EntityTypeLoader.get("minecraft:arrow");
EntityType ARROW = EntityTypeImpl.get("minecraft:arrow");
EntityType AXOLOTL = EntityTypeLoader.get("minecraft:axolotl");
EntityType AXOLOTL = EntityTypeImpl.get("minecraft:axolotl");
EntityType BAT = EntityTypeLoader.get("minecraft:bat");
EntityType BAT = EntityTypeImpl.get("minecraft:bat");
EntityType BEE = EntityTypeLoader.get("minecraft:bee");
EntityType BEE = EntityTypeImpl.get("minecraft:bee");
EntityType BLAZE = EntityTypeLoader.get("minecraft:blaze");
EntityType BLAZE = EntityTypeImpl.get("minecraft:blaze");
EntityType BOAT = EntityTypeLoader.get("minecraft:boat");
EntityType BOAT = EntityTypeImpl.get("minecraft:boat");
EntityType CAT = EntityTypeLoader.get("minecraft:cat");
EntityType CAT = EntityTypeImpl.get("minecraft:cat");
EntityType CAVE_SPIDER = EntityTypeLoader.get("minecraft:cave_spider");
EntityType CAVE_SPIDER = EntityTypeImpl.get("minecraft:cave_spider");
EntityType CHICKEN = EntityTypeLoader.get("minecraft:chicken");
EntityType CHICKEN = EntityTypeImpl.get("minecraft:chicken");
EntityType COD = EntityTypeLoader.get("minecraft:cod");
EntityType COD = EntityTypeImpl.get("minecraft:cod");
EntityType COW = EntityTypeLoader.get("minecraft:cow");
EntityType COW = EntityTypeImpl.get("minecraft:cow");
EntityType CREEPER = EntityTypeLoader.get("minecraft:creeper");
EntityType CREEPER = EntityTypeImpl.get("minecraft:creeper");
EntityType DOLPHIN = EntityTypeLoader.get("minecraft:dolphin");
EntityType DOLPHIN = EntityTypeImpl.get("minecraft:dolphin");
EntityType DONKEY = EntityTypeLoader.get("minecraft:donkey");
EntityType DONKEY = EntityTypeImpl.get("minecraft:donkey");
EntityType DRAGON_FIREBALL = EntityTypeLoader.get("minecraft:dragon_fireball");
EntityType DRAGON_FIREBALL = EntityTypeImpl.get("minecraft:dragon_fireball");
EntityType DROWNED = EntityTypeLoader.get("minecraft:drowned");
EntityType DROWNED = EntityTypeImpl.get("minecraft:drowned");
EntityType ELDER_GUARDIAN = EntityTypeLoader.get("minecraft:elder_guardian");
EntityType ELDER_GUARDIAN = EntityTypeImpl.get("minecraft:elder_guardian");
EntityType END_CRYSTAL = EntityTypeLoader.get("minecraft:end_crystal");
EntityType END_CRYSTAL = EntityTypeImpl.get("minecraft:end_crystal");
EntityType ENDER_DRAGON = EntityTypeLoader.get("minecraft:ender_dragon");
EntityType ENDER_DRAGON = EntityTypeImpl.get("minecraft:ender_dragon");
EntityType ENDERMAN = EntityTypeLoader.get("minecraft:enderman");
EntityType ENDERMAN = EntityTypeImpl.get("minecraft:enderman");
EntityType ENDERMITE = EntityTypeLoader.get("minecraft:endermite");
EntityType ENDERMITE = EntityTypeImpl.get("minecraft:endermite");
EntityType EVOKER = EntityTypeLoader.get("minecraft:evoker");
EntityType EVOKER = EntityTypeImpl.get("minecraft:evoker");
EntityType EVOKER_FANGS = EntityTypeLoader.get("minecraft:evoker_fangs");
EntityType EVOKER_FANGS = EntityTypeImpl.get("minecraft:evoker_fangs");
EntityType EXPERIENCE_ORB = EntityTypeLoader.get("minecraft:experience_orb");
EntityType EXPERIENCE_ORB = EntityTypeImpl.get("minecraft:experience_orb");
EntityType EYE_OF_ENDER = EntityTypeLoader.get("minecraft:eye_of_ender");
EntityType EYE_OF_ENDER = EntityTypeImpl.get("minecraft:eye_of_ender");
EntityType FALLING_BLOCK = EntityTypeLoader.get("minecraft:falling_block");
EntityType FALLING_BLOCK = EntityTypeImpl.get("minecraft:falling_block");
EntityType FIREWORK_ROCKET = EntityTypeLoader.get("minecraft:firework_rocket");
EntityType FIREWORK_ROCKET = EntityTypeImpl.get("minecraft:firework_rocket");
EntityType FOX = EntityTypeLoader.get("minecraft:fox");
EntityType FOX = EntityTypeImpl.get("minecraft:fox");
EntityType GHAST = EntityTypeLoader.get("minecraft:ghast");
EntityType GHAST = EntityTypeImpl.get("minecraft:ghast");
EntityType GIANT = EntityTypeLoader.get("minecraft:giant");
EntityType GIANT = EntityTypeImpl.get("minecraft:giant");
EntityType GLOW_ITEM_FRAME = EntityTypeLoader.get("minecraft:glow_item_frame");
EntityType GLOW_ITEM_FRAME = EntityTypeImpl.get("minecraft:glow_item_frame");
EntityType GLOW_SQUID = EntityTypeLoader.get("minecraft:glow_squid");
EntityType GLOW_SQUID = EntityTypeImpl.get("minecraft:glow_squid");
EntityType GOAT = EntityTypeLoader.get("minecraft:goat");
EntityType GOAT = EntityTypeImpl.get("minecraft:goat");
EntityType GUARDIAN = EntityTypeLoader.get("minecraft:guardian");
EntityType GUARDIAN = EntityTypeImpl.get("minecraft:guardian");
EntityType HOGLIN = EntityTypeLoader.get("minecraft:hoglin");
EntityType HOGLIN = EntityTypeImpl.get("minecraft:hoglin");
EntityType HORSE = EntityTypeLoader.get("minecraft:horse");
EntityType HORSE = EntityTypeImpl.get("minecraft:horse");
EntityType HUSK = EntityTypeLoader.get("minecraft:husk");
EntityType HUSK = EntityTypeImpl.get("minecraft:husk");
EntityType ILLUSIONER = EntityTypeLoader.get("minecraft:illusioner");
EntityType ILLUSIONER = EntityTypeImpl.get("minecraft:illusioner");
EntityType IRON_GOLEM = EntityTypeLoader.get("minecraft:iron_golem");
EntityType IRON_GOLEM = EntityTypeImpl.get("minecraft:iron_golem");
EntityType ITEM = EntityTypeLoader.get("minecraft:item");
EntityType ITEM = EntityTypeImpl.get("minecraft:item");
EntityType ITEM_FRAME = EntityTypeLoader.get("minecraft:item_frame");
EntityType ITEM_FRAME = EntityTypeImpl.get("minecraft:item_frame");
EntityType FIREBALL = EntityTypeLoader.get("minecraft:fireball");
EntityType FIREBALL = EntityTypeImpl.get("minecraft:fireball");
EntityType LEASH_KNOT = EntityTypeLoader.get("minecraft:leash_knot");
EntityType LEASH_KNOT = EntityTypeImpl.get("minecraft:leash_knot");
EntityType LIGHTNING_BOLT = EntityTypeLoader.get("minecraft:lightning_bolt");
EntityType LIGHTNING_BOLT = EntityTypeImpl.get("minecraft:lightning_bolt");
EntityType LLAMA = EntityTypeLoader.get("minecraft:llama");
EntityType LLAMA = EntityTypeImpl.get("minecraft:llama");
EntityType LLAMA_SPIT = EntityTypeLoader.get("minecraft:llama_spit");
EntityType LLAMA_SPIT = EntityTypeImpl.get("minecraft:llama_spit");
EntityType MAGMA_CUBE = EntityTypeLoader.get("minecraft:magma_cube");
EntityType MAGMA_CUBE = EntityTypeImpl.get("minecraft:magma_cube");
EntityType MARKER = EntityTypeLoader.get("minecraft:marker");
EntityType MARKER = EntityTypeImpl.get("minecraft:marker");
EntityType MINECART = EntityTypeLoader.get("minecraft:minecart");
EntityType MINECART = EntityTypeImpl.get("minecraft:minecart");
EntityType CHEST_MINECART = EntityTypeLoader.get("minecraft:chest_minecart");
EntityType CHEST_MINECART = EntityTypeImpl.get("minecraft:chest_minecart");
EntityType COMMAND_BLOCK_MINECART = EntityTypeLoader.get("minecraft:command_block_minecart");
EntityType COMMAND_BLOCK_MINECART = EntityTypeImpl.get("minecraft:command_block_minecart");
EntityType FURNACE_MINECART = EntityTypeLoader.get("minecraft:furnace_minecart");
EntityType FURNACE_MINECART = EntityTypeImpl.get("minecraft:furnace_minecart");
EntityType HOPPER_MINECART = EntityTypeLoader.get("minecraft:hopper_minecart");
EntityType HOPPER_MINECART = EntityTypeImpl.get("minecraft:hopper_minecart");
EntityType SPAWNER_MINECART = EntityTypeLoader.get("minecraft:spawner_minecart");
EntityType SPAWNER_MINECART = EntityTypeImpl.get("minecraft:spawner_minecart");
EntityType TNT_MINECART = EntityTypeLoader.get("minecraft:tnt_minecart");
EntityType TNT_MINECART = EntityTypeImpl.get("minecraft:tnt_minecart");
EntityType MULE = EntityTypeLoader.get("minecraft:mule");
EntityType MULE = EntityTypeImpl.get("minecraft:mule");
EntityType MOOSHROOM = EntityTypeLoader.get("minecraft:mooshroom");
EntityType MOOSHROOM = EntityTypeImpl.get("minecraft:mooshroom");
EntityType OCELOT = EntityTypeLoader.get("minecraft:ocelot");
EntityType OCELOT = EntityTypeImpl.get("minecraft:ocelot");
EntityType PAINTING = EntityTypeLoader.get("minecraft:painting");
EntityType PAINTING = EntityTypeImpl.get("minecraft:painting");
EntityType PANDA = EntityTypeLoader.get("minecraft:panda");
EntityType PANDA = EntityTypeImpl.get("minecraft:panda");
EntityType PARROT = EntityTypeLoader.get("minecraft:parrot");
EntityType PARROT = EntityTypeImpl.get("minecraft:parrot");
EntityType PHANTOM = EntityTypeLoader.get("minecraft:phantom");
EntityType PHANTOM = EntityTypeImpl.get("minecraft:phantom");
EntityType PIG = EntityTypeLoader.get("minecraft:pig");
EntityType PIG = EntityTypeImpl.get("minecraft:pig");
EntityType PIGLIN = EntityTypeLoader.get("minecraft:piglin");
EntityType PIGLIN = EntityTypeImpl.get("minecraft:piglin");
EntityType PIGLIN_BRUTE = EntityTypeLoader.get("minecraft:piglin_brute");
EntityType PIGLIN_BRUTE = EntityTypeImpl.get("minecraft:piglin_brute");
EntityType PILLAGER = EntityTypeLoader.get("minecraft:pillager");
EntityType PILLAGER = EntityTypeImpl.get("minecraft:pillager");
EntityType POLAR_BEAR = EntityTypeLoader.get("minecraft:polar_bear");
EntityType POLAR_BEAR = EntityTypeImpl.get("minecraft:polar_bear");
EntityType TNT = EntityTypeLoader.get("minecraft:tnt");
EntityType TNT = EntityTypeImpl.get("minecraft:tnt");
EntityType PUFFERFISH = EntityTypeLoader.get("minecraft:pufferfish");
EntityType PUFFERFISH = EntityTypeImpl.get("minecraft:pufferfish");
EntityType RABBIT = EntityTypeLoader.get("minecraft:rabbit");
EntityType RABBIT = EntityTypeImpl.get("minecraft:rabbit");
EntityType RAVAGER = EntityTypeLoader.get("minecraft:ravager");
EntityType RAVAGER = EntityTypeImpl.get("minecraft:ravager");
EntityType SALMON = EntityTypeLoader.get("minecraft:salmon");
EntityType SALMON = EntityTypeImpl.get("minecraft:salmon");
EntityType SHEEP = EntityTypeLoader.get("minecraft:sheep");
EntityType SHEEP = EntityTypeImpl.get("minecraft:sheep");
EntityType SHULKER = EntityTypeLoader.get("minecraft:shulker");
EntityType SHULKER = EntityTypeImpl.get("minecraft:shulker");
EntityType SHULKER_BULLET = EntityTypeLoader.get("minecraft:shulker_bullet");
EntityType SHULKER_BULLET = EntityTypeImpl.get("minecraft:shulker_bullet");
EntityType SILVERFISH = EntityTypeLoader.get("minecraft:silverfish");
EntityType SILVERFISH = EntityTypeImpl.get("minecraft:silverfish");
EntityType SKELETON = EntityTypeLoader.get("minecraft:skeleton");
EntityType SKELETON = EntityTypeImpl.get("minecraft:skeleton");
EntityType SKELETON_HORSE = EntityTypeLoader.get("minecraft:skeleton_horse");
EntityType SKELETON_HORSE = EntityTypeImpl.get("minecraft:skeleton_horse");
EntityType SLIME = EntityTypeLoader.get("minecraft:slime");
EntityType SLIME = EntityTypeImpl.get("minecraft:slime");
EntityType SMALL_FIREBALL = EntityTypeLoader.get("minecraft:small_fireball");
EntityType SMALL_FIREBALL = EntityTypeImpl.get("minecraft:small_fireball");
EntityType SNOW_GOLEM = EntityTypeLoader.get("minecraft:snow_golem");
EntityType SNOW_GOLEM = EntityTypeImpl.get("minecraft:snow_golem");
EntityType SNOWBALL = EntityTypeLoader.get("minecraft:snowball");
EntityType SNOWBALL = EntityTypeImpl.get("minecraft:snowball");
EntityType SPECTRAL_ARROW = EntityTypeLoader.get("minecraft:spectral_arrow");
EntityType SPECTRAL_ARROW = EntityTypeImpl.get("minecraft:spectral_arrow");
EntityType SPIDER = EntityTypeLoader.get("minecraft:spider");
EntityType SPIDER = EntityTypeImpl.get("minecraft:spider");
EntityType SQUID = EntityTypeLoader.get("minecraft:squid");
EntityType SQUID = EntityTypeImpl.get("minecraft:squid");
EntityType STRAY = EntityTypeLoader.get("minecraft:stray");
EntityType STRAY = EntityTypeImpl.get("minecraft:stray");
EntityType STRIDER = EntityTypeLoader.get("minecraft:strider");
EntityType STRIDER = EntityTypeImpl.get("minecraft:strider");
EntityType EGG = EntityTypeLoader.get("minecraft:egg");
EntityType EGG = EntityTypeImpl.get("minecraft:egg");
EntityType ENDER_PEARL = EntityTypeLoader.get("minecraft:ender_pearl");
EntityType ENDER_PEARL = EntityTypeImpl.get("minecraft:ender_pearl");
EntityType EXPERIENCE_BOTTLE = EntityTypeLoader.get("minecraft:experience_bottle");
EntityType EXPERIENCE_BOTTLE = EntityTypeImpl.get("minecraft:experience_bottle");
EntityType POTION = EntityTypeLoader.get("minecraft:potion");
EntityType POTION = EntityTypeImpl.get("minecraft:potion");
EntityType TRIDENT = EntityTypeLoader.get("minecraft:trident");
EntityType TRIDENT = EntityTypeImpl.get("minecraft:trident");
EntityType TRADER_LLAMA = EntityTypeLoader.get("minecraft:trader_llama");
EntityType TRADER_LLAMA = EntityTypeImpl.get("minecraft:trader_llama");
EntityType TROPICAL_FISH = EntityTypeLoader.get("minecraft:tropical_fish");
EntityType TROPICAL_FISH = EntityTypeImpl.get("minecraft:tropical_fish");
EntityType TURTLE = EntityTypeLoader.get("minecraft:turtle");
EntityType TURTLE = EntityTypeImpl.get("minecraft:turtle");
EntityType VEX = EntityTypeLoader.get("minecraft:vex");
EntityType VEX = EntityTypeImpl.get("minecraft:vex");
EntityType VILLAGER = EntityTypeLoader.get("minecraft:villager");
EntityType VILLAGER = EntityTypeImpl.get("minecraft:villager");
EntityType VINDICATOR = EntityTypeLoader.get("minecraft:vindicator");
EntityType VINDICATOR = EntityTypeImpl.get("minecraft:vindicator");
EntityType WANDERING_TRADER = EntityTypeLoader.get("minecraft:wandering_trader");
EntityType WANDERING_TRADER = EntityTypeImpl.get("minecraft:wandering_trader");
EntityType WITCH = EntityTypeLoader.get("minecraft:witch");
EntityType WITCH = EntityTypeImpl.get("minecraft:witch");
EntityType WITHER = EntityTypeLoader.get("minecraft:wither");
EntityType WITHER = EntityTypeImpl.get("minecraft:wither");
EntityType WITHER_SKELETON = EntityTypeLoader.get("minecraft:wither_skeleton");
EntityType WITHER_SKELETON = EntityTypeImpl.get("minecraft:wither_skeleton");
EntityType WITHER_SKULL = EntityTypeLoader.get("minecraft:wither_skull");
EntityType WITHER_SKULL = EntityTypeImpl.get("minecraft:wither_skull");
EntityType WOLF = EntityTypeLoader.get("minecraft:wolf");
EntityType WOLF = EntityTypeImpl.get("minecraft:wolf");
EntityType ZOGLIN = EntityTypeLoader.get("minecraft:zoglin");
EntityType ZOGLIN = EntityTypeImpl.get("minecraft:zoglin");
EntityType ZOMBIE = EntityTypeLoader.get("minecraft:zombie");
EntityType ZOMBIE = EntityTypeImpl.get("minecraft:zombie");
EntityType ZOMBIE_HORSE = EntityTypeLoader.get("minecraft:zombie_horse");
EntityType ZOMBIE_HORSE = EntityTypeImpl.get("minecraft:zombie_horse");
EntityType ZOMBIE_VILLAGER = EntityTypeLoader.get("minecraft:zombie_villager");
EntityType ZOMBIE_VILLAGER = EntityTypeImpl.get("minecraft:zombie_villager");
EntityType ZOMBIFIED_PIGLIN = EntityTypeLoader.get("minecraft:zombified_piglin");
EntityType ZOMBIFIED_PIGLIN = EntityTypeImpl.get("minecraft:zombified_piglin");
EntityType PLAYER = EntityTypeLoader.get("minecraft:player");
EntityType PLAYER = EntityTypeImpl.get("minecraft:player");
EntityType FISHING_BOBBER = EntityTypeLoader.get("minecraft:fishing_bobber");
EntityType FISHING_BOBBER = EntityTypeImpl.get("minecraft:fishing_bobber");
}

View File

@ -5,79 +5,79 @@ package net.minestom.server.item;
*/
@SuppressWarnings("unused")
interface EnchantmentConstants {
Enchantment PROTECTION = EnchantmentLoader.get("minecraft:protection");
Enchantment PROTECTION = EnchantmentImpl.get("minecraft:protection");
Enchantment FIRE_PROTECTION = EnchantmentLoader.get("minecraft:fire_protection");
Enchantment FIRE_PROTECTION = EnchantmentImpl.get("minecraft:fire_protection");
Enchantment FEATHER_FALLING = EnchantmentLoader.get("minecraft:feather_falling");
Enchantment FEATHER_FALLING = EnchantmentImpl.get("minecraft:feather_falling");
Enchantment BLAST_PROTECTION = EnchantmentLoader.get("minecraft:blast_protection");
Enchantment BLAST_PROTECTION = EnchantmentImpl.get("minecraft:blast_protection");
Enchantment PROJECTILE_PROTECTION = EnchantmentLoader.get("minecraft:projectile_protection");
Enchantment PROJECTILE_PROTECTION = EnchantmentImpl.get("minecraft:projectile_protection");
Enchantment RESPIRATION = EnchantmentLoader.get("minecraft:respiration");
Enchantment RESPIRATION = EnchantmentImpl.get("minecraft:respiration");
Enchantment AQUA_AFFINITY = EnchantmentLoader.get("minecraft:aqua_affinity");
Enchantment AQUA_AFFINITY = EnchantmentImpl.get("minecraft:aqua_affinity");
Enchantment THORNS = EnchantmentLoader.get("minecraft:thorns");
Enchantment THORNS = EnchantmentImpl.get("minecraft:thorns");
Enchantment DEPTH_STRIDER = EnchantmentLoader.get("minecraft:depth_strider");
Enchantment DEPTH_STRIDER = EnchantmentImpl.get("minecraft:depth_strider");
Enchantment FROST_WALKER = EnchantmentLoader.get("minecraft:frost_walker");
Enchantment FROST_WALKER = EnchantmentImpl.get("minecraft:frost_walker");
Enchantment BINDING_CURSE = EnchantmentLoader.get("minecraft:binding_curse");
Enchantment BINDING_CURSE = EnchantmentImpl.get("minecraft:binding_curse");
Enchantment SOUL_SPEED = EnchantmentLoader.get("minecraft:soul_speed");
Enchantment SOUL_SPEED = EnchantmentImpl.get("minecraft:soul_speed");
Enchantment SHARPNESS = EnchantmentLoader.get("minecraft:sharpness");
Enchantment SHARPNESS = EnchantmentImpl.get("minecraft:sharpness");
Enchantment SMITE = EnchantmentLoader.get("minecraft:smite");
Enchantment SMITE = EnchantmentImpl.get("minecraft:smite");
Enchantment BANE_OF_ARTHROPODS = EnchantmentLoader.get("minecraft:bane_of_arthropods");
Enchantment BANE_OF_ARTHROPODS = EnchantmentImpl.get("minecraft:bane_of_arthropods");
Enchantment KNOCKBACK = EnchantmentLoader.get("minecraft:knockback");
Enchantment KNOCKBACK = EnchantmentImpl.get("minecraft:knockback");
Enchantment FIRE_ASPECT = EnchantmentLoader.get("minecraft:fire_aspect");
Enchantment FIRE_ASPECT = EnchantmentImpl.get("minecraft:fire_aspect");
Enchantment LOOTING = EnchantmentLoader.get("minecraft:looting");
Enchantment LOOTING = EnchantmentImpl.get("minecraft:looting");
Enchantment SWEEPING = EnchantmentLoader.get("minecraft:sweeping");
Enchantment SWEEPING = EnchantmentImpl.get("minecraft:sweeping");
Enchantment EFFICIENCY = EnchantmentLoader.get("minecraft:efficiency");
Enchantment EFFICIENCY = EnchantmentImpl.get("minecraft:efficiency");
Enchantment SILK_TOUCH = EnchantmentLoader.get("minecraft:silk_touch");
Enchantment SILK_TOUCH = EnchantmentImpl.get("minecraft:silk_touch");
Enchantment UNBREAKING = EnchantmentLoader.get("minecraft:unbreaking");
Enchantment UNBREAKING = EnchantmentImpl.get("minecraft:unbreaking");
Enchantment FORTUNE = EnchantmentLoader.get("minecraft:fortune");
Enchantment FORTUNE = EnchantmentImpl.get("minecraft:fortune");
Enchantment POWER = EnchantmentLoader.get("minecraft:power");
Enchantment POWER = EnchantmentImpl.get("minecraft:power");
Enchantment PUNCH = EnchantmentLoader.get("minecraft:punch");
Enchantment PUNCH = EnchantmentImpl.get("minecraft:punch");
Enchantment FLAME = EnchantmentLoader.get("minecraft:flame");
Enchantment FLAME = EnchantmentImpl.get("minecraft:flame");
Enchantment INFINITY = EnchantmentLoader.get("minecraft:infinity");
Enchantment INFINITY = EnchantmentImpl.get("minecraft:infinity");
Enchantment LUCK_OF_THE_SEA = EnchantmentLoader.get("minecraft:luck_of_the_sea");
Enchantment LUCK_OF_THE_SEA = EnchantmentImpl.get("minecraft:luck_of_the_sea");
Enchantment LURE = EnchantmentLoader.get("minecraft:lure");
Enchantment LURE = EnchantmentImpl.get("minecraft:lure");
Enchantment LOYALTY = EnchantmentLoader.get("minecraft:loyalty");
Enchantment LOYALTY = EnchantmentImpl.get("minecraft:loyalty");
Enchantment IMPALING = EnchantmentLoader.get("minecraft:impaling");
Enchantment IMPALING = EnchantmentImpl.get("minecraft:impaling");
Enchantment RIPTIDE = EnchantmentLoader.get("minecraft:riptide");
Enchantment RIPTIDE = EnchantmentImpl.get("minecraft:riptide");
Enchantment CHANNELING = EnchantmentLoader.get("minecraft:channeling");
Enchantment CHANNELING = EnchantmentImpl.get("minecraft:channeling");
Enchantment MULTISHOT = EnchantmentLoader.get("minecraft:multishot");
Enchantment MULTISHOT = EnchantmentImpl.get("minecraft:multishot");
Enchantment QUICK_CHARGE = EnchantmentLoader.get("minecraft:quick_charge");
Enchantment QUICK_CHARGE = EnchantmentImpl.get("minecraft:quick_charge");
Enchantment PIERCING = EnchantmentLoader.get("minecraft:piercing");
Enchantment PIERCING = EnchantmentImpl.get("minecraft:piercing");
Enchantment MENDING = EnchantmentLoader.get("minecraft:mending");
Enchantment MENDING = EnchantmentImpl.get("minecraft:mending");
Enchantment VANISHING_CURSE = EnchantmentLoader.get("minecraft:vanishing_curse");
Enchantment VANISHING_CURSE = EnchantmentImpl.get("minecraft:vanishing_curse");
}

View File

@ -5,181 +5,181 @@ package net.minestom.server.particle;
*/
@SuppressWarnings("unused")
interface ParticleConstants {
Particle AMBIENT_ENTITY_EFFECT = ParticleLoader.get("minecraft:ambient_entity_effect");
Particle AMBIENT_ENTITY_EFFECT = ParticleImpl.get("minecraft:ambient_entity_effect");
Particle ANGRY_VILLAGER = ParticleLoader.get("minecraft:angry_villager");
Particle ANGRY_VILLAGER = ParticleImpl.get("minecraft:angry_villager");
Particle BARRIER = ParticleLoader.get("minecraft:barrier");
Particle BARRIER = ParticleImpl.get("minecraft:barrier");
Particle LIGHT = ParticleLoader.get("minecraft:light");
Particle LIGHT = ParticleImpl.get("minecraft:light");
Particle BLOCK = ParticleLoader.get("minecraft:block");
Particle BLOCK = ParticleImpl.get("minecraft:block");
Particle BUBBLE = ParticleLoader.get("minecraft:bubble");
Particle BUBBLE = ParticleImpl.get("minecraft:bubble");
Particle CLOUD = ParticleLoader.get("minecraft:cloud");
Particle CLOUD = ParticleImpl.get("minecraft:cloud");
Particle CRIT = ParticleLoader.get("minecraft:crit");
Particle CRIT = ParticleImpl.get("minecraft:crit");
Particle DAMAGE_INDICATOR = ParticleLoader.get("minecraft:damage_indicator");
Particle DAMAGE_INDICATOR = ParticleImpl.get("minecraft:damage_indicator");
Particle DRAGON_BREATH = ParticleLoader.get("minecraft:dragon_breath");
Particle DRAGON_BREATH = ParticleImpl.get("minecraft:dragon_breath");
Particle DRIPPING_LAVA = ParticleLoader.get("minecraft:dripping_lava");
Particle DRIPPING_LAVA = ParticleImpl.get("minecraft:dripping_lava");
Particle FALLING_LAVA = ParticleLoader.get("minecraft:falling_lava");
Particle FALLING_LAVA = ParticleImpl.get("minecraft:falling_lava");
Particle LANDING_LAVA = ParticleLoader.get("minecraft:landing_lava");
Particle LANDING_LAVA = ParticleImpl.get("minecraft:landing_lava");
Particle DRIPPING_WATER = ParticleLoader.get("minecraft:dripping_water");
Particle DRIPPING_WATER = ParticleImpl.get("minecraft:dripping_water");
Particle FALLING_WATER = ParticleLoader.get("minecraft:falling_water");
Particle FALLING_WATER = ParticleImpl.get("minecraft:falling_water");
Particle DUST = ParticleLoader.get("minecraft:dust");
Particle DUST = ParticleImpl.get("minecraft:dust");
Particle DUST_COLOR_TRANSITION = ParticleLoader.get("minecraft:dust_color_transition");
Particle DUST_COLOR_TRANSITION = ParticleImpl.get("minecraft:dust_color_transition");
Particle EFFECT = ParticleLoader.get("minecraft:effect");
Particle EFFECT = ParticleImpl.get("minecraft:effect");
Particle ELDER_GUARDIAN = ParticleLoader.get("minecraft:elder_guardian");
Particle ELDER_GUARDIAN = ParticleImpl.get("minecraft:elder_guardian");
Particle ENCHANTED_HIT = ParticleLoader.get("minecraft:enchanted_hit");
Particle ENCHANTED_HIT = ParticleImpl.get("minecraft:enchanted_hit");
Particle ENCHANT = ParticleLoader.get("minecraft:enchant");
Particle ENCHANT = ParticleImpl.get("minecraft:enchant");
Particle END_ROD = ParticleLoader.get("minecraft:end_rod");
Particle END_ROD = ParticleImpl.get("minecraft:end_rod");
Particle ENTITY_EFFECT = ParticleLoader.get("minecraft:entity_effect");
Particle ENTITY_EFFECT = ParticleImpl.get("minecraft:entity_effect");
Particle EXPLOSION_EMITTER = ParticleLoader.get("minecraft:explosion_emitter");
Particle EXPLOSION_EMITTER = ParticleImpl.get("minecraft:explosion_emitter");
Particle EXPLOSION = ParticleLoader.get("minecraft:explosion");
Particle EXPLOSION = ParticleImpl.get("minecraft:explosion");
Particle FALLING_DUST = ParticleLoader.get("minecraft:falling_dust");
Particle FALLING_DUST = ParticleImpl.get("minecraft:falling_dust");
Particle FIREWORK = ParticleLoader.get("minecraft:firework");
Particle FIREWORK = ParticleImpl.get("minecraft:firework");
Particle FISHING = ParticleLoader.get("minecraft:fishing");
Particle FISHING = ParticleImpl.get("minecraft:fishing");
Particle FLAME = ParticleLoader.get("minecraft:flame");
Particle FLAME = ParticleImpl.get("minecraft:flame");
Particle SOUL_FIRE_FLAME = ParticleLoader.get("minecraft:soul_fire_flame");
Particle SOUL_FIRE_FLAME = ParticleImpl.get("minecraft:soul_fire_flame");
Particle SOUL = ParticleLoader.get("minecraft:soul");
Particle SOUL = ParticleImpl.get("minecraft:soul");
Particle FLASH = ParticleLoader.get("minecraft:flash");
Particle FLASH = ParticleImpl.get("minecraft:flash");
Particle HAPPY_VILLAGER = ParticleLoader.get("minecraft:happy_villager");
Particle HAPPY_VILLAGER = ParticleImpl.get("minecraft:happy_villager");
Particle COMPOSTER = ParticleLoader.get("minecraft:composter");
Particle COMPOSTER = ParticleImpl.get("minecraft:composter");
Particle HEART = ParticleLoader.get("minecraft:heart");
Particle HEART = ParticleImpl.get("minecraft:heart");
Particle INSTANT_EFFECT = ParticleLoader.get("minecraft:instant_effect");
Particle INSTANT_EFFECT = ParticleImpl.get("minecraft:instant_effect");
Particle ITEM = ParticleLoader.get("minecraft:item");
Particle ITEM = ParticleImpl.get("minecraft:item");
Particle VIBRATION = ParticleLoader.get("minecraft:vibration");
Particle VIBRATION = ParticleImpl.get("minecraft:vibration");
Particle ITEM_SLIME = ParticleLoader.get("minecraft:item_slime");
Particle ITEM_SLIME = ParticleImpl.get("minecraft:item_slime");
Particle ITEM_SNOWBALL = ParticleLoader.get("minecraft:item_snowball");
Particle ITEM_SNOWBALL = ParticleImpl.get("minecraft:item_snowball");
Particle LARGE_SMOKE = ParticleLoader.get("minecraft:large_smoke");
Particle LARGE_SMOKE = ParticleImpl.get("minecraft:large_smoke");
Particle LAVA = ParticleLoader.get("minecraft:lava");
Particle LAVA = ParticleImpl.get("minecraft:lava");
Particle MYCELIUM = ParticleLoader.get("minecraft:mycelium");
Particle MYCELIUM = ParticleImpl.get("minecraft:mycelium");
Particle NOTE = ParticleLoader.get("minecraft:note");
Particle NOTE = ParticleImpl.get("minecraft:note");
Particle POOF = ParticleLoader.get("minecraft:poof");
Particle POOF = ParticleImpl.get("minecraft:poof");
Particle PORTAL = ParticleLoader.get("minecraft:portal");
Particle PORTAL = ParticleImpl.get("minecraft:portal");
Particle RAIN = ParticleLoader.get("minecraft:rain");
Particle RAIN = ParticleImpl.get("minecraft:rain");
Particle SMOKE = ParticleLoader.get("minecraft:smoke");
Particle SMOKE = ParticleImpl.get("minecraft:smoke");
Particle SNEEZE = ParticleLoader.get("minecraft:sneeze");
Particle SNEEZE = ParticleImpl.get("minecraft:sneeze");
Particle SPIT = ParticleLoader.get("minecraft:spit");
Particle SPIT = ParticleImpl.get("minecraft:spit");
Particle SQUID_INK = ParticleLoader.get("minecraft:squid_ink");
Particle SQUID_INK = ParticleImpl.get("minecraft:squid_ink");
Particle SWEEP_ATTACK = ParticleLoader.get("minecraft:sweep_attack");
Particle SWEEP_ATTACK = ParticleImpl.get("minecraft:sweep_attack");
Particle TOTEM_OF_UNDYING = ParticleLoader.get("minecraft:totem_of_undying");
Particle TOTEM_OF_UNDYING = ParticleImpl.get("minecraft:totem_of_undying");
Particle UNDERWATER = ParticleLoader.get("minecraft:underwater");
Particle UNDERWATER = ParticleImpl.get("minecraft:underwater");
Particle SPLASH = ParticleLoader.get("minecraft:splash");
Particle SPLASH = ParticleImpl.get("minecraft:splash");
Particle WITCH = ParticleLoader.get("minecraft:witch");
Particle WITCH = ParticleImpl.get("minecraft:witch");
Particle BUBBLE_POP = ParticleLoader.get("minecraft:bubble_pop");
Particle BUBBLE_POP = ParticleImpl.get("minecraft:bubble_pop");
Particle CURRENT_DOWN = ParticleLoader.get("minecraft:current_down");
Particle CURRENT_DOWN = ParticleImpl.get("minecraft:current_down");
Particle BUBBLE_COLUMN_UP = ParticleLoader.get("minecraft:bubble_column_up");
Particle BUBBLE_COLUMN_UP = ParticleImpl.get("minecraft:bubble_column_up");
Particle NAUTILUS = ParticleLoader.get("minecraft:nautilus");
Particle NAUTILUS = ParticleImpl.get("minecraft:nautilus");
Particle DOLPHIN = ParticleLoader.get("minecraft:dolphin");
Particle DOLPHIN = ParticleImpl.get("minecraft:dolphin");
Particle CAMPFIRE_COSY_SMOKE = ParticleLoader.get("minecraft:campfire_cosy_smoke");
Particle CAMPFIRE_COSY_SMOKE = ParticleImpl.get("minecraft:campfire_cosy_smoke");
Particle CAMPFIRE_SIGNAL_SMOKE = ParticleLoader.get("minecraft:campfire_signal_smoke");
Particle CAMPFIRE_SIGNAL_SMOKE = ParticleImpl.get("minecraft:campfire_signal_smoke");
Particle DRIPPING_HONEY = ParticleLoader.get("minecraft:dripping_honey");
Particle DRIPPING_HONEY = ParticleImpl.get("minecraft:dripping_honey");
Particle FALLING_HONEY = ParticleLoader.get("minecraft:falling_honey");
Particle FALLING_HONEY = ParticleImpl.get("minecraft:falling_honey");
Particle LANDING_HONEY = ParticleLoader.get("minecraft:landing_honey");
Particle LANDING_HONEY = ParticleImpl.get("minecraft:landing_honey");
Particle FALLING_NECTAR = ParticleLoader.get("minecraft:falling_nectar");
Particle FALLING_NECTAR = ParticleImpl.get("minecraft:falling_nectar");
Particle FALLING_SPORE_BLOSSOM = ParticleLoader.get("minecraft:falling_spore_blossom");
Particle FALLING_SPORE_BLOSSOM = ParticleImpl.get("minecraft:falling_spore_blossom");
Particle ASH = ParticleLoader.get("minecraft:ash");
Particle ASH = ParticleImpl.get("minecraft:ash");
Particle CRIMSON_SPORE = ParticleLoader.get("minecraft:crimson_spore");
Particle CRIMSON_SPORE = ParticleImpl.get("minecraft:crimson_spore");
Particle WARPED_SPORE = ParticleLoader.get("minecraft:warped_spore");
Particle WARPED_SPORE = ParticleImpl.get("minecraft:warped_spore");
Particle SPORE_BLOSSOM_AIR = ParticleLoader.get("minecraft:spore_blossom_air");
Particle SPORE_BLOSSOM_AIR = ParticleImpl.get("minecraft:spore_blossom_air");
Particle DRIPPING_OBSIDIAN_TEAR = ParticleLoader.get("minecraft:dripping_obsidian_tear");
Particle DRIPPING_OBSIDIAN_TEAR = ParticleImpl.get("minecraft:dripping_obsidian_tear");
Particle FALLING_OBSIDIAN_TEAR = ParticleLoader.get("minecraft:falling_obsidian_tear");
Particle FALLING_OBSIDIAN_TEAR = ParticleImpl.get("minecraft:falling_obsidian_tear");
Particle LANDING_OBSIDIAN_TEAR = ParticleLoader.get("minecraft:landing_obsidian_tear");
Particle LANDING_OBSIDIAN_TEAR = ParticleImpl.get("minecraft:landing_obsidian_tear");
Particle REVERSE_PORTAL = ParticleLoader.get("minecraft:reverse_portal");
Particle REVERSE_PORTAL = ParticleImpl.get("minecraft:reverse_portal");
Particle WHITE_ASH = ParticleLoader.get("minecraft:white_ash");
Particle WHITE_ASH = ParticleImpl.get("minecraft:white_ash");
Particle SMALL_FLAME = ParticleLoader.get("minecraft:small_flame");
Particle SMALL_FLAME = ParticleImpl.get("minecraft:small_flame");
Particle SNOWFLAKE = ParticleLoader.get("minecraft:snowflake");
Particle SNOWFLAKE = ParticleImpl.get("minecraft:snowflake");
Particle DRIPPING_DRIPSTONE_LAVA = ParticleLoader.get("minecraft:dripping_dripstone_lava");
Particle DRIPPING_DRIPSTONE_LAVA = ParticleImpl.get("minecraft:dripping_dripstone_lava");
Particle FALLING_DRIPSTONE_LAVA = ParticleLoader.get("minecraft:falling_dripstone_lava");
Particle FALLING_DRIPSTONE_LAVA = ParticleImpl.get("minecraft:falling_dripstone_lava");
Particle DRIPPING_DRIPSTONE_WATER = ParticleLoader.get("minecraft:dripping_dripstone_water");
Particle DRIPPING_DRIPSTONE_WATER = ParticleImpl.get("minecraft:dripping_dripstone_water");
Particle FALLING_DRIPSTONE_WATER = ParticleLoader.get("minecraft:falling_dripstone_water");
Particle FALLING_DRIPSTONE_WATER = ParticleImpl.get("minecraft:falling_dripstone_water");
Particle GLOW_SQUID_INK = ParticleLoader.get("minecraft:glow_squid_ink");
Particle GLOW_SQUID_INK = ParticleImpl.get("minecraft:glow_squid_ink");
Particle GLOW = ParticleLoader.get("minecraft:glow");
Particle GLOW = ParticleImpl.get("minecraft:glow");
Particle WAX_ON = ParticleLoader.get("minecraft:wax_on");
Particle WAX_ON = ParticleImpl.get("minecraft:wax_on");
Particle WAX_OFF = ParticleLoader.get("minecraft:wax_off");
Particle WAX_OFF = ParticleImpl.get("minecraft:wax_off");
Particle ELECTRIC_SPARK = ParticleLoader.get("minecraft:electric_spark");
Particle ELECTRIC_SPARK = ParticleImpl.get("minecraft:electric_spark");
Particle SCRAPE = ParticleLoader.get("minecraft:scrape");
Particle SCRAPE = ParticleImpl.get("minecraft:scrape");
}

View File

@ -5,67 +5,67 @@ package net.minestom.server.potion;
*/
@SuppressWarnings("unused")
interface PotionEffectConstants {
PotionEffect SPEED = PotionEffectLoader.get("minecraft:speed");
PotionEffect SPEED = PotionEffectImpl.get("minecraft:speed");
PotionEffect SLOWNESS = PotionEffectLoader.get("minecraft:slowness");
PotionEffect SLOWNESS = PotionEffectImpl.get("minecraft:slowness");
PotionEffect HASTE = PotionEffectLoader.get("minecraft:haste");
PotionEffect HASTE = PotionEffectImpl.get("minecraft:haste");
PotionEffect MINING_FATIGUE = PotionEffectLoader.get("minecraft:mining_fatigue");
PotionEffect MINING_FATIGUE = PotionEffectImpl.get("minecraft:mining_fatigue");
PotionEffect STRENGTH = PotionEffectLoader.get("minecraft:strength");
PotionEffect STRENGTH = PotionEffectImpl.get("minecraft:strength");
PotionEffect INSTANT_HEALTH = PotionEffectLoader.get("minecraft:instant_health");
PotionEffect INSTANT_HEALTH = PotionEffectImpl.get("minecraft:instant_health");
PotionEffect INSTANT_DAMAGE = PotionEffectLoader.get("minecraft:instant_damage");
PotionEffect INSTANT_DAMAGE = PotionEffectImpl.get("minecraft:instant_damage");
PotionEffect JUMP_BOOST = PotionEffectLoader.get("minecraft:jump_boost");
PotionEffect JUMP_BOOST = PotionEffectImpl.get("minecraft:jump_boost");
PotionEffect NAUSEA = PotionEffectLoader.get("minecraft:nausea");
PotionEffect NAUSEA = PotionEffectImpl.get("minecraft:nausea");
PotionEffect REGENERATION = PotionEffectLoader.get("minecraft:regeneration");
PotionEffect REGENERATION = PotionEffectImpl.get("minecraft:regeneration");
PotionEffect RESISTANCE = PotionEffectLoader.get("minecraft:resistance");
PotionEffect RESISTANCE = PotionEffectImpl.get("minecraft:resistance");
PotionEffect FIRE_RESISTANCE = PotionEffectLoader.get("minecraft:fire_resistance");
PotionEffect FIRE_RESISTANCE = PotionEffectImpl.get("minecraft:fire_resistance");
PotionEffect WATER_BREATHING = PotionEffectLoader.get("minecraft:water_breathing");
PotionEffect WATER_BREATHING = PotionEffectImpl.get("minecraft:water_breathing");
PotionEffect INVISIBILITY = PotionEffectLoader.get("minecraft:invisibility");
PotionEffect INVISIBILITY = PotionEffectImpl.get("minecraft:invisibility");
PotionEffect BLINDNESS = PotionEffectLoader.get("minecraft:blindness");
PotionEffect BLINDNESS = PotionEffectImpl.get("minecraft:blindness");
PotionEffect NIGHT_VISION = PotionEffectLoader.get("minecraft:night_vision");
PotionEffect NIGHT_VISION = PotionEffectImpl.get("minecraft:night_vision");
PotionEffect HUNGER = PotionEffectLoader.get("minecraft:hunger");
PotionEffect HUNGER = PotionEffectImpl.get("minecraft:hunger");
PotionEffect WEAKNESS = PotionEffectLoader.get("minecraft:weakness");
PotionEffect WEAKNESS = PotionEffectImpl.get("minecraft:weakness");
PotionEffect POISON = PotionEffectLoader.get("minecraft:poison");
PotionEffect POISON = PotionEffectImpl.get("minecraft:poison");
PotionEffect WITHER = PotionEffectLoader.get("minecraft:wither");
PotionEffect WITHER = PotionEffectImpl.get("minecraft:wither");
PotionEffect HEALTH_BOOST = PotionEffectLoader.get("minecraft:health_boost");
PotionEffect HEALTH_BOOST = PotionEffectImpl.get("minecraft:health_boost");
PotionEffect ABSORPTION = PotionEffectLoader.get("minecraft:absorption");
PotionEffect ABSORPTION = PotionEffectImpl.get("minecraft:absorption");
PotionEffect SATURATION = PotionEffectLoader.get("minecraft:saturation");
PotionEffect SATURATION = PotionEffectImpl.get("minecraft:saturation");
PotionEffect GLOWING = PotionEffectLoader.get("minecraft:glowing");
PotionEffect GLOWING = PotionEffectImpl.get("minecraft:glowing");
PotionEffect LEVITATION = PotionEffectLoader.get("minecraft:levitation");
PotionEffect LEVITATION = PotionEffectImpl.get("minecraft:levitation");
PotionEffect LUCK = PotionEffectLoader.get("minecraft:luck");
PotionEffect LUCK = PotionEffectImpl.get("minecraft:luck");
PotionEffect UNLUCK = PotionEffectLoader.get("minecraft:unluck");
PotionEffect UNLUCK = PotionEffectImpl.get("minecraft:unluck");
PotionEffect SLOW_FALLING = PotionEffectLoader.get("minecraft:slow_falling");
PotionEffect SLOW_FALLING = PotionEffectImpl.get("minecraft:slow_falling");
PotionEffect CONDUIT_POWER = PotionEffectLoader.get("minecraft:conduit_power");
PotionEffect CONDUIT_POWER = PotionEffectImpl.get("minecraft:conduit_power");
PotionEffect DOLPHINS_GRACE = PotionEffectLoader.get("minecraft:dolphins_grace");
PotionEffect DOLPHINS_GRACE = PotionEffectImpl.get("minecraft:dolphins_grace");
PotionEffect BAD_OMEN = PotionEffectLoader.get("minecraft:bad_omen");
PotionEffect BAD_OMEN = PotionEffectImpl.get("minecraft:bad_omen");
PotionEffect HERO_OF_THE_VILLAGE = PotionEffectLoader.get("minecraft:hero_of_the_village");
PotionEffect HERO_OF_THE_VILLAGE = PotionEffectImpl.get("minecraft:hero_of_the_village");
}

View File

@ -5,89 +5,89 @@ package net.minestom.server.potion;
*/
@SuppressWarnings("unused")
interface PotionTypeConstants {
PotionType EMPTY = PotionTypeLoader.get("minecraft:empty");
PotionType EMPTY = PotionTypeImpl.get("minecraft:empty");
PotionType WATER = PotionTypeLoader.get("minecraft:water");
PotionType WATER = PotionTypeImpl.get("minecraft:water");
PotionType MUNDANE = PotionTypeLoader.get("minecraft:mundane");
PotionType MUNDANE = PotionTypeImpl.get("minecraft:mundane");
PotionType THICK = PotionTypeLoader.get("minecraft:thick");
PotionType THICK = PotionTypeImpl.get("minecraft:thick");
PotionType AWKWARD = PotionTypeLoader.get("minecraft:awkward");
PotionType AWKWARD = PotionTypeImpl.get("minecraft:awkward");
PotionType NIGHT_VISION = PotionTypeLoader.get("minecraft:night_vision");
PotionType NIGHT_VISION = PotionTypeImpl.get("minecraft:night_vision");
PotionType LONG_NIGHT_VISION = PotionTypeLoader.get("minecraft:long_night_vision");
PotionType LONG_NIGHT_VISION = PotionTypeImpl.get("minecraft:long_night_vision");
PotionType INVISIBILITY = PotionTypeLoader.get("minecraft:invisibility");
PotionType INVISIBILITY = PotionTypeImpl.get("minecraft:invisibility");
PotionType LONG_INVISIBILITY = PotionTypeLoader.get("minecraft:long_invisibility");
PotionType LONG_INVISIBILITY = PotionTypeImpl.get("minecraft:long_invisibility");
PotionType LEAPING = PotionTypeLoader.get("minecraft:leaping");
PotionType LEAPING = PotionTypeImpl.get("minecraft:leaping");
PotionType LONG_LEAPING = PotionTypeLoader.get("minecraft:long_leaping");
PotionType LONG_LEAPING = PotionTypeImpl.get("minecraft:long_leaping");
PotionType STRONG_LEAPING = PotionTypeLoader.get("minecraft:strong_leaping");
PotionType STRONG_LEAPING = PotionTypeImpl.get("minecraft:strong_leaping");
PotionType FIRE_RESISTANCE = PotionTypeLoader.get("minecraft:fire_resistance");
PotionType FIRE_RESISTANCE = PotionTypeImpl.get("minecraft:fire_resistance");
PotionType LONG_FIRE_RESISTANCE = PotionTypeLoader.get("minecraft:long_fire_resistance");
PotionType LONG_FIRE_RESISTANCE = PotionTypeImpl.get("minecraft:long_fire_resistance");
PotionType SWIFTNESS = PotionTypeLoader.get("minecraft:swiftness");
PotionType SWIFTNESS = PotionTypeImpl.get("minecraft:swiftness");
PotionType LONG_SWIFTNESS = PotionTypeLoader.get("minecraft:long_swiftness");
PotionType LONG_SWIFTNESS = PotionTypeImpl.get("minecraft:long_swiftness");
PotionType STRONG_SWIFTNESS = PotionTypeLoader.get("minecraft:strong_swiftness");
PotionType STRONG_SWIFTNESS = PotionTypeImpl.get("minecraft:strong_swiftness");
PotionType SLOWNESS = PotionTypeLoader.get("minecraft:slowness");
PotionType SLOWNESS = PotionTypeImpl.get("minecraft:slowness");
PotionType LONG_SLOWNESS = PotionTypeLoader.get("minecraft:long_slowness");
PotionType LONG_SLOWNESS = PotionTypeImpl.get("minecraft:long_slowness");
PotionType STRONG_SLOWNESS = PotionTypeLoader.get("minecraft:strong_slowness");
PotionType STRONG_SLOWNESS = PotionTypeImpl.get("minecraft:strong_slowness");
PotionType TURTLE_MASTER = PotionTypeLoader.get("minecraft:turtle_master");
PotionType TURTLE_MASTER = PotionTypeImpl.get("minecraft:turtle_master");
PotionType LONG_TURTLE_MASTER = PotionTypeLoader.get("minecraft:long_turtle_master");
PotionType LONG_TURTLE_MASTER = PotionTypeImpl.get("minecraft:long_turtle_master");
PotionType STRONG_TURTLE_MASTER = PotionTypeLoader.get("minecraft:strong_turtle_master");
PotionType STRONG_TURTLE_MASTER = PotionTypeImpl.get("minecraft:strong_turtle_master");
PotionType WATER_BREATHING = PotionTypeLoader.get("minecraft:water_breathing");
PotionType WATER_BREATHING = PotionTypeImpl.get("minecraft:water_breathing");
PotionType LONG_WATER_BREATHING = PotionTypeLoader.get("minecraft:long_water_breathing");
PotionType LONG_WATER_BREATHING = PotionTypeImpl.get("minecraft:long_water_breathing");
PotionType HEALING = PotionTypeLoader.get("minecraft:healing");
PotionType HEALING = PotionTypeImpl.get("minecraft:healing");
PotionType STRONG_HEALING = PotionTypeLoader.get("minecraft:strong_healing");
PotionType STRONG_HEALING = PotionTypeImpl.get("minecraft:strong_healing");
PotionType HARMING = PotionTypeLoader.get("minecraft:harming");
PotionType HARMING = PotionTypeImpl.get("minecraft:harming");
PotionType STRONG_HARMING = PotionTypeLoader.get("minecraft:strong_harming");
PotionType STRONG_HARMING = PotionTypeImpl.get("minecraft:strong_harming");
PotionType POISON = PotionTypeLoader.get("minecraft:poison");
PotionType POISON = PotionTypeImpl.get("minecraft:poison");
PotionType LONG_POISON = PotionTypeLoader.get("minecraft:long_poison");
PotionType LONG_POISON = PotionTypeImpl.get("minecraft:long_poison");
PotionType STRONG_POISON = PotionTypeLoader.get("minecraft:strong_poison");
PotionType STRONG_POISON = PotionTypeImpl.get("minecraft:strong_poison");
PotionType REGENERATION = PotionTypeLoader.get("minecraft:regeneration");
PotionType REGENERATION = PotionTypeImpl.get("minecraft:regeneration");
PotionType LONG_REGENERATION = PotionTypeLoader.get("minecraft:long_regeneration");
PotionType LONG_REGENERATION = PotionTypeImpl.get("minecraft:long_regeneration");
PotionType STRONG_REGENERATION = PotionTypeLoader.get("minecraft:strong_regeneration");
PotionType STRONG_REGENERATION = PotionTypeImpl.get("minecraft:strong_regeneration");
PotionType STRENGTH = PotionTypeLoader.get("minecraft:strength");
PotionType STRENGTH = PotionTypeImpl.get("minecraft:strength");
PotionType LONG_STRENGTH = PotionTypeLoader.get("minecraft:long_strength");
PotionType LONG_STRENGTH = PotionTypeImpl.get("minecraft:long_strength");
PotionType STRONG_STRENGTH = PotionTypeLoader.get("minecraft:strong_strength");
PotionType STRONG_STRENGTH = PotionTypeImpl.get("minecraft:strong_strength");
PotionType WEAKNESS = PotionTypeLoader.get("minecraft:weakness");
PotionType WEAKNESS = PotionTypeImpl.get("minecraft:weakness");
PotionType LONG_WEAKNESS = PotionTypeLoader.get("minecraft:long_weakness");
PotionType LONG_WEAKNESS = PotionTypeImpl.get("minecraft:long_weakness");
PotionType LUCK = PotionTypeLoader.get("minecraft:luck");
PotionType LUCK = PotionTypeImpl.get("minecraft:luck");
PotionType SLOW_FALLING = PotionTypeLoader.get("minecraft:slow_falling");
PotionType SLOW_FALLING = PotionTypeImpl.get("minecraft:slow_falling");
PotionType LONG_SLOW_FALLING = PotionTypeLoader.get("minecraft:long_slow_falling");
PotionType LONG_SLOW_FALLING = PotionTypeImpl.get("minecraft:long_slow_falling");
}

View File

@ -5,153 +5,153 @@ package net.minestom.server.statistic;
*/
@SuppressWarnings("unused")
interface StatisticTypeConstants {
StatisticType LEAVE_GAME = StatisticTypeLoader.get("minecraft:leave_game");
StatisticType LEAVE_GAME = StatisticTypeImpl.get("minecraft:leave_game");
StatisticType PLAY_TIME = StatisticTypeLoader.get("minecraft:play_time");
StatisticType PLAY_TIME = StatisticTypeImpl.get("minecraft:play_time");
StatisticType TOTAL_WORLD_TIME = StatisticTypeLoader.get("minecraft:total_world_time");
StatisticType TOTAL_WORLD_TIME = StatisticTypeImpl.get("minecraft:total_world_time");
StatisticType TIME_SINCE_DEATH = StatisticTypeLoader.get("minecraft:time_since_death");
StatisticType TIME_SINCE_DEATH = StatisticTypeImpl.get("minecraft:time_since_death");
StatisticType TIME_SINCE_REST = StatisticTypeLoader.get("minecraft:time_since_rest");
StatisticType TIME_SINCE_REST = StatisticTypeImpl.get("minecraft:time_since_rest");
StatisticType SNEAK_TIME = StatisticTypeLoader.get("minecraft:sneak_time");
StatisticType SNEAK_TIME = StatisticTypeImpl.get("minecraft:sneak_time");
StatisticType WALK_ONE_CM = StatisticTypeLoader.get("minecraft:walk_one_cm");
StatisticType WALK_ONE_CM = StatisticTypeImpl.get("minecraft:walk_one_cm");
StatisticType CROUCH_ONE_CM = StatisticTypeLoader.get("minecraft:crouch_one_cm");
StatisticType CROUCH_ONE_CM = StatisticTypeImpl.get("minecraft:crouch_one_cm");
StatisticType SPRINT_ONE_CM = StatisticTypeLoader.get("minecraft:sprint_one_cm");
StatisticType SPRINT_ONE_CM = StatisticTypeImpl.get("minecraft:sprint_one_cm");
StatisticType WALK_ON_WATER_ONE_CM = StatisticTypeLoader.get("minecraft:walk_on_water_one_cm");
StatisticType WALK_ON_WATER_ONE_CM = StatisticTypeImpl.get("minecraft:walk_on_water_one_cm");
StatisticType FALL_ONE_CM = StatisticTypeLoader.get("minecraft:fall_one_cm");
StatisticType FALL_ONE_CM = StatisticTypeImpl.get("minecraft:fall_one_cm");
StatisticType CLIMB_ONE_CM = StatisticTypeLoader.get("minecraft:climb_one_cm");
StatisticType CLIMB_ONE_CM = StatisticTypeImpl.get("minecraft:climb_one_cm");
StatisticType FLY_ONE_CM = StatisticTypeLoader.get("minecraft:fly_one_cm");
StatisticType FLY_ONE_CM = StatisticTypeImpl.get("minecraft:fly_one_cm");
StatisticType WALK_UNDER_WATER_ONE_CM = StatisticTypeLoader.get("minecraft:walk_under_water_one_cm");
StatisticType WALK_UNDER_WATER_ONE_CM = StatisticTypeImpl.get("minecraft:walk_under_water_one_cm");
StatisticType MINECART_ONE_CM = StatisticTypeLoader.get("minecraft:minecart_one_cm");
StatisticType MINECART_ONE_CM = StatisticTypeImpl.get("minecraft:minecart_one_cm");
StatisticType BOAT_ONE_CM = StatisticTypeLoader.get("minecraft:boat_one_cm");
StatisticType BOAT_ONE_CM = StatisticTypeImpl.get("minecraft:boat_one_cm");
StatisticType PIG_ONE_CM = StatisticTypeLoader.get("minecraft:pig_one_cm");
StatisticType PIG_ONE_CM = StatisticTypeImpl.get("minecraft:pig_one_cm");
StatisticType HORSE_ONE_CM = StatisticTypeLoader.get("minecraft:horse_one_cm");
StatisticType HORSE_ONE_CM = StatisticTypeImpl.get("minecraft:horse_one_cm");
StatisticType AVIATE_ONE_CM = StatisticTypeLoader.get("minecraft:aviate_one_cm");
StatisticType AVIATE_ONE_CM = StatisticTypeImpl.get("minecraft:aviate_one_cm");
StatisticType SWIM_ONE_CM = StatisticTypeLoader.get("minecraft:swim_one_cm");
StatisticType SWIM_ONE_CM = StatisticTypeImpl.get("minecraft:swim_one_cm");
StatisticType STRIDER_ONE_CM = StatisticTypeLoader.get("minecraft:strider_one_cm");
StatisticType STRIDER_ONE_CM = StatisticTypeImpl.get("minecraft:strider_one_cm");
StatisticType JUMP = StatisticTypeLoader.get("minecraft:jump");
StatisticType JUMP = StatisticTypeImpl.get("minecraft:jump");
StatisticType DROP = StatisticTypeLoader.get("minecraft:drop");
StatisticType DROP = StatisticTypeImpl.get("minecraft:drop");
StatisticType DAMAGE_DEALT = StatisticTypeLoader.get("minecraft:damage_dealt");
StatisticType DAMAGE_DEALT = StatisticTypeImpl.get("minecraft:damage_dealt");
StatisticType DAMAGE_DEALT_ABSORBED = StatisticTypeLoader.get("minecraft:damage_dealt_absorbed");
StatisticType DAMAGE_DEALT_ABSORBED = StatisticTypeImpl.get("minecraft:damage_dealt_absorbed");
StatisticType DAMAGE_DEALT_RESISTED = StatisticTypeLoader.get("minecraft:damage_dealt_resisted");
StatisticType DAMAGE_DEALT_RESISTED = StatisticTypeImpl.get("minecraft:damage_dealt_resisted");
StatisticType DAMAGE_TAKEN = StatisticTypeLoader.get("minecraft:damage_taken");
StatisticType DAMAGE_TAKEN = StatisticTypeImpl.get("minecraft:damage_taken");
StatisticType DAMAGE_BLOCKED_BY_SHIELD = StatisticTypeLoader.get("minecraft:damage_blocked_by_shield");
StatisticType DAMAGE_BLOCKED_BY_SHIELD = StatisticTypeImpl.get("minecraft:damage_blocked_by_shield");
StatisticType DAMAGE_ABSORBED = StatisticTypeLoader.get("minecraft:damage_absorbed");
StatisticType DAMAGE_ABSORBED = StatisticTypeImpl.get("minecraft:damage_absorbed");
StatisticType DAMAGE_RESISTED = StatisticTypeLoader.get("minecraft:damage_resisted");
StatisticType DAMAGE_RESISTED = StatisticTypeImpl.get("minecraft:damage_resisted");
StatisticType DEATHS = StatisticTypeLoader.get("minecraft:deaths");
StatisticType DEATHS = StatisticTypeImpl.get("minecraft:deaths");
StatisticType MOB_KILLS = StatisticTypeLoader.get("minecraft:mob_kills");
StatisticType MOB_KILLS = StatisticTypeImpl.get("minecraft:mob_kills");
StatisticType ANIMALS_BRED = StatisticTypeLoader.get("minecraft:animals_bred");
StatisticType ANIMALS_BRED = StatisticTypeImpl.get("minecraft:animals_bred");
StatisticType PLAYER_KILLS = StatisticTypeLoader.get("minecraft:player_kills");
StatisticType PLAYER_KILLS = StatisticTypeImpl.get("minecraft:player_kills");
StatisticType FISH_CAUGHT = StatisticTypeLoader.get("minecraft:fish_caught");
StatisticType FISH_CAUGHT = StatisticTypeImpl.get("minecraft:fish_caught");
StatisticType TALKED_TO_VILLAGER = StatisticTypeLoader.get("minecraft:talked_to_villager");
StatisticType TALKED_TO_VILLAGER = StatisticTypeImpl.get("minecraft:talked_to_villager");
StatisticType TRADED_WITH_VILLAGER = StatisticTypeLoader.get("minecraft:traded_with_villager");
StatisticType TRADED_WITH_VILLAGER = StatisticTypeImpl.get("minecraft:traded_with_villager");
StatisticType EAT_CAKE_SLICE = StatisticTypeLoader.get("minecraft:eat_cake_slice");
StatisticType EAT_CAKE_SLICE = StatisticTypeImpl.get("minecraft:eat_cake_slice");
StatisticType FILL_CAULDRON = StatisticTypeLoader.get("minecraft:fill_cauldron");
StatisticType FILL_CAULDRON = StatisticTypeImpl.get("minecraft:fill_cauldron");
StatisticType USE_CAULDRON = StatisticTypeLoader.get("minecraft:use_cauldron");
StatisticType USE_CAULDRON = StatisticTypeImpl.get("minecraft:use_cauldron");
StatisticType CLEAN_ARMOR = StatisticTypeLoader.get("minecraft:clean_armor");
StatisticType CLEAN_ARMOR = StatisticTypeImpl.get("minecraft:clean_armor");
StatisticType CLEAN_BANNER = StatisticTypeLoader.get("minecraft:clean_banner");
StatisticType CLEAN_BANNER = StatisticTypeImpl.get("minecraft:clean_banner");
StatisticType CLEAN_SHULKER_BOX = StatisticTypeLoader.get("minecraft:clean_shulker_box");
StatisticType CLEAN_SHULKER_BOX = StatisticTypeImpl.get("minecraft:clean_shulker_box");
StatisticType INTERACT_WITH_BREWINGSTAND = StatisticTypeLoader.get("minecraft:interact_with_brewingstand");
StatisticType INTERACT_WITH_BREWINGSTAND = StatisticTypeImpl.get("minecraft:interact_with_brewingstand");
StatisticType INTERACT_WITH_BEACON = StatisticTypeLoader.get("minecraft:interact_with_beacon");
StatisticType INTERACT_WITH_BEACON = StatisticTypeImpl.get("minecraft:interact_with_beacon");
StatisticType INSPECT_DROPPER = StatisticTypeLoader.get("minecraft:inspect_dropper");
StatisticType INSPECT_DROPPER = StatisticTypeImpl.get("minecraft:inspect_dropper");
StatisticType INSPECT_HOPPER = StatisticTypeLoader.get("minecraft:inspect_hopper");
StatisticType INSPECT_HOPPER = StatisticTypeImpl.get("minecraft:inspect_hopper");
StatisticType INSPECT_DISPENSER = StatisticTypeLoader.get("minecraft:inspect_dispenser");
StatisticType INSPECT_DISPENSER = StatisticTypeImpl.get("minecraft:inspect_dispenser");
StatisticType PLAY_NOTEBLOCK = StatisticTypeLoader.get("minecraft:play_noteblock");
StatisticType PLAY_NOTEBLOCK = StatisticTypeImpl.get("minecraft:play_noteblock");
StatisticType TUNE_NOTEBLOCK = StatisticTypeLoader.get("minecraft:tune_noteblock");
StatisticType TUNE_NOTEBLOCK = StatisticTypeImpl.get("minecraft:tune_noteblock");
StatisticType POT_FLOWER = StatisticTypeLoader.get("minecraft:pot_flower");
StatisticType POT_FLOWER = StatisticTypeImpl.get("minecraft:pot_flower");
StatisticType TRIGGER_TRAPPED_CHEST = StatisticTypeLoader.get("minecraft:trigger_trapped_chest");
StatisticType TRIGGER_TRAPPED_CHEST = StatisticTypeImpl.get("minecraft:trigger_trapped_chest");
StatisticType OPEN_ENDERCHEST = StatisticTypeLoader.get("minecraft:open_enderchest");
StatisticType OPEN_ENDERCHEST = StatisticTypeImpl.get("minecraft:open_enderchest");
StatisticType ENCHANT_ITEM = StatisticTypeLoader.get("minecraft:enchant_item");
StatisticType ENCHANT_ITEM = StatisticTypeImpl.get("minecraft:enchant_item");
StatisticType PLAY_RECORD = StatisticTypeLoader.get("minecraft:play_record");
StatisticType PLAY_RECORD = StatisticTypeImpl.get("minecraft:play_record");
StatisticType INTERACT_WITH_FURNACE = StatisticTypeLoader.get("minecraft:interact_with_furnace");
StatisticType INTERACT_WITH_FURNACE = StatisticTypeImpl.get("minecraft:interact_with_furnace");
StatisticType INTERACT_WITH_CRAFTING_TABLE = StatisticTypeLoader.get("minecraft:interact_with_crafting_table");
StatisticType INTERACT_WITH_CRAFTING_TABLE = StatisticTypeImpl.get("minecraft:interact_with_crafting_table");
StatisticType OPEN_CHEST = StatisticTypeLoader.get("minecraft:open_chest");
StatisticType OPEN_CHEST = StatisticTypeImpl.get("minecraft:open_chest");
StatisticType SLEEP_IN_BED = StatisticTypeLoader.get("minecraft:sleep_in_bed");
StatisticType SLEEP_IN_BED = StatisticTypeImpl.get("minecraft:sleep_in_bed");
StatisticType OPEN_SHULKER_BOX = StatisticTypeLoader.get("minecraft:open_shulker_box");
StatisticType OPEN_SHULKER_BOX = StatisticTypeImpl.get("minecraft:open_shulker_box");
StatisticType OPEN_BARREL = StatisticTypeLoader.get("minecraft:open_barrel");
StatisticType OPEN_BARREL = StatisticTypeImpl.get("minecraft:open_barrel");
StatisticType INTERACT_WITH_BLAST_FURNACE = StatisticTypeLoader.get("minecraft:interact_with_blast_furnace");
StatisticType INTERACT_WITH_BLAST_FURNACE = StatisticTypeImpl.get("minecraft:interact_with_blast_furnace");
StatisticType INTERACT_WITH_SMOKER = StatisticTypeLoader.get("minecraft:interact_with_smoker");
StatisticType INTERACT_WITH_SMOKER = StatisticTypeImpl.get("minecraft:interact_with_smoker");
StatisticType INTERACT_WITH_LECTERN = StatisticTypeLoader.get("minecraft:interact_with_lectern");
StatisticType INTERACT_WITH_LECTERN = StatisticTypeImpl.get("minecraft:interact_with_lectern");
StatisticType INTERACT_WITH_CAMPFIRE = StatisticTypeLoader.get("minecraft:interact_with_campfire");
StatisticType INTERACT_WITH_CAMPFIRE = StatisticTypeImpl.get("minecraft:interact_with_campfire");
StatisticType INTERACT_WITH_CARTOGRAPHY_TABLE = StatisticTypeLoader.get("minecraft:interact_with_cartography_table");
StatisticType INTERACT_WITH_CARTOGRAPHY_TABLE = StatisticTypeImpl.get("minecraft:interact_with_cartography_table");
StatisticType INTERACT_WITH_LOOM = StatisticTypeLoader.get("minecraft:interact_with_loom");
StatisticType INTERACT_WITH_LOOM = StatisticTypeImpl.get("minecraft:interact_with_loom");
StatisticType INTERACT_WITH_STONECUTTER = StatisticTypeLoader.get("minecraft:interact_with_stonecutter");
StatisticType INTERACT_WITH_STONECUTTER = StatisticTypeImpl.get("minecraft:interact_with_stonecutter");
StatisticType BELL_RING = StatisticTypeLoader.get("minecraft:bell_ring");
StatisticType BELL_RING = StatisticTypeImpl.get("minecraft:bell_ring");
StatisticType RAID_TRIGGER = StatisticTypeLoader.get("minecraft:raid_trigger");
StatisticType RAID_TRIGGER = StatisticTypeImpl.get("minecraft:raid_trigger");
StatisticType RAID_WIN = StatisticTypeLoader.get("minecraft:raid_win");
StatisticType RAID_WIN = StatisticTypeImpl.get("minecraft:raid_win");
StatisticType INTERACT_WITH_ANVIL = StatisticTypeLoader.get("minecraft:interact_with_anvil");
StatisticType INTERACT_WITH_ANVIL = StatisticTypeImpl.get("minecraft:interact_with_anvil");
StatisticType INTERACT_WITH_GRINDSTONE = StatisticTypeLoader.get("minecraft:interact_with_grindstone");
StatisticType INTERACT_WITH_GRINDSTONE = StatisticTypeImpl.get("minecraft:interact_with_grindstone");
StatisticType TARGET_HIT = StatisticTypeLoader.get("minecraft:target_hit");
StatisticType TARGET_HIT = StatisticTypeImpl.get("minecraft:target_hit");
StatisticType INTERACT_WITH_SMITHING_TABLE = StatisticTypeLoader.get("minecraft:interact_with_smithing_table");
StatisticType INTERACT_WITH_SMITHING_TABLE = StatisticTypeImpl.get("minecraft:interact_with_smithing_table");
}

View File

@ -140,15 +140,15 @@ public class Entity implements Viewable, Tickable, TagHandler, PermissionHandler
setBoundingBox(entityType.width(), entityType.height(), entityType.width());
this.entityMeta = EntityTypeLoader.createMeta(entityType, this, this.metadata);
this.entityMeta = EntityTypeImpl.createMeta(entityType, this, this.metadata);
setAutoViewable(true);
Entity.ENTITY_BY_ID.put(id, this);
Entity.ENTITY_BY_UUID.put(uuid, this);
this.gravityAcceleration = EntityTypeLoader.getAcceleration(entityType.name());
this.gravityDragPerTick = EntityTypeLoader.getDrag(entityType.name());
this.gravityAcceleration = EntityTypeImpl.getAcceleration(entityType.name());
this.gravityDragPerTick = EntityTypeImpl.getDrag(entityType.name());
}
public Entity(@NotNull EntityType entityType) {
@ -362,7 +362,7 @@ public class Entity implements Viewable, Tickable, TagHandler, PermissionHandler
synchronized (entityTypeLock) {
this.entityType = entityType;
this.metadata = new Metadata(this);
this.entityMeta = EntityTypeLoader.createMeta(entityType, this, this.metadata);
this.entityMeta = EntityTypeImpl.createMeta(entityType, this, this.metadata);
Set<Player> viewers = new HashSet<>(getViewers());
getViewers().forEach(this::removeViewer0);

View File

@ -39,11 +39,11 @@ public interface EntityType extends ProtocolObject, EntityTypeConstants {
}
static @NotNull Collection<@NotNull EntityType> values() {
return EntityTypeLoader.values();
return EntityTypeImpl.values();
}
static EntityType fromNamespaceId(@NotNull String namespaceID) {
return EntityTypeLoader.get(namespaceID);
return EntityTypeImpl.get(namespaceID);
}
static EntityType fromNamespaceId(@NotNull NamespaceID namespaceID) {
@ -51,6 +51,6 @@ public interface EntityType extends ProtocolObject, EntityTypeConstants {
}
static @Nullable EntityType fromId(int id) {
return EntityTypeLoader.getId(id);
return EntityTypeImpl.getId(id);
}
}

View File

@ -1,9 +1,259 @@
package net.minestom.server.entity;
import com.google.gson.JsonObject;
import net.minestom.server.entity.metadata.EntityMeta;
import net.minestom.server.entity.metadata.PlayerMeta;
import net.minestom.server.entity.metadata.ambient.BatMeta;
import net.minestom.server.entity.metadata.animal.*;
import net.minestom.server.entity.metadata.animal.tameable.CatMeta;
import net.minestom.server.entity.metadata.animal.tameable.ParrotMeta;
import net.minestom.server.entity.metadata.animal.tameable.WolfMeta;
import net.minestom.server.entity.metadata.arrow.ArrowMeta;
import net.minestom.server.entity.metadata.arrow.SpectralArrowMeta;
import net.minestom.server.entity.metadata.arrow.ThrownTridentMeta;
import net.minestom.server.entity.metadata.flying.GhastMeta;
import net.minestom.server.entity.metadata.flying.PhantomMeta;
import net.minestom.server.entity.metadata.golem.IronGolemMeta;
import net.minestom.server.entity.metadata.golem.ShulkerMeta;
import net.minestom.server.entity.metadata.golem.SnowGolemMeta;
import net.minestom.server.entity.metadata.item.*;
import net.minestom.server.entity.metadata.minecart.*;
import net.minestom.server.entity.metadata.monster.*;
import net.minestom.server.entity.metadata.monster.raider.*;
import net.minestom.server.entity.metadata.monster.skeleton.SkeletonMeta;
import net.minestom.server.entity.metadata.monster.skeleton.StrayMeta;
import net.minestom.server.entity.metadata.monster.skeleton.WitherSkeletonMeta;
import net.minestom.server.entity.metadata.monster.zombie.DrownedMeta;
import net.minestom.server.entity.metadata.monster.zombie.ZombieMeta;
import net.minestom.server.entity.metadata.monster.zombie.ZombieVillagerMeta;
import net.minestom.server.entity.metadata.monster.zombie.ZombifiedPiglinMeta;
import net.minestom.server.entity.metadata.other.*;
import net.minestom.server.entity.metadata.villager.VillagerMeta;
import net.minestom.server.entity.metadata.villager.WanderingTraderMeta;
import net.minestom.server.entity.metadata.water.AxolotlMeta;
import net.minestom.server.entity.metadata.water.DolphinMeta;
import net.minestom.server.entity.metadata.water.GlowSquidMeta;
import net.minestom.server.entity.metadata.water.SquidMeta;
import net.minestom.server.entity.metadata.water.fish.CodMeta;
import net.minestom.server.entity.metadata.water.fish.PufferfishMeta;
import net.minestom.server.entity.metadata.water.fish.SalmonMeta;
import net.minestom.server.entity.metadata.water.fish.TropicalFishMeta;
import net.minestom.server.registry.Registry;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.function.BiFunction;
final class EntityTypeImpl implements EntityType {
private static final Registry.Loader<EntityType> LOADER = new Registry.Loader<>();
private static final Map<String, BiFunction<Entity, Metadata, EntityMeta>> ENTITY_META_SUPPLIER = createMetaMap();
private static final Map<String, Double> ACCELERATION_MAP = createAccelerationMap();
private static final Map<String, Double> DRAG_MAP = createDragMap();
static EntityType get(@NotNull String namespace) {
return LOADER.get(namespace);
}
static EntityType getSafe(@NotNull String namespace) {
return LOADER.getSafe(namespace);
}
static EntityType getId(int id) {
return LOADER.getId(id);
}
static Collection<EntityType> values() {
return LOADER.values();
}
static EntityMeta createMeta(EntityType entityType, Entity entity, Metadata metadata) {
return ENTITY_META_SUPPLIER.get(entityType.name()).apply(entity, metadata);
}
static double getAcceleration(String namespace) {
return ACCELERATION_MAP.getOrDefault(namespace, 0.08);
}
static double getDrag(String namespace) {
return DRAG_MAP.getOrDefault(namespace, 0.02);
}
static {
// Load data from file
JsonObject entities = Registry.load(Registry.Resource.ENTITIES);
entities.entrySet().forEach(entry -> {
final String namespace = entry.getKey();
final JsonObject entityObject = entry.getValue().getAsJsonObject();
LOADER.register(new EntityTypeImpl(Registry.entity(namespace, entityObject, null)));
});
}
private static Map<String, BiFunction<Entity, Metadata, EntityMeta>> createMetaMap() {
Map<String, BiFunction<Entity, Metadata, EntityMeta>> supplier = new HashMap<>();
supplier.put("minecraft:area_effect_cloud", AreaEffectCloudMeta::new);
supplier.put("minecraft:armor_stand", ArmorStandMeta::new);
supplier.put("minecraft:arrow", ArrowMeta::new);
supplier.put("minecraft:axolotl", AxolotlMeta::new);
supplier.put("minecraft:bat", BatMeta::new);
supplier.put("minecraft:bee", BeeMeta::new);
supplier.put("minecraft:boat", BoatMeta::new);
supplier.put("minecraft:cat", CatMeta::new);
supplier.put("minecraft:cave_spider", CaveSpiderMeta::new);
supplier.put("minecraft:chicken", ChickenMeta::new);
supplier.put("minecraft:cod", CodMeta::new);
supplier.put("minecraft:cow", CowMeta::new);
supplier.put("minecraft:creeper", CreeperMeta::new);
supplier.put("minecraft:dolphin", DolphinMeta::new);
supplier.put("minecraft:donkey", DonkeyMeta::new);
supplier.put("minecraft:dragon_fireball", DragonFireballMeta::new);
supplier.put("minecraft:drowned", DrownedMeta::new);
supplier.put("minecraft:elder_guardian", ElderGuardianMeta::new);
supplier.put("minecraft:end_crystal", EndCrystalMeta::new);
supplier.put("minecraft:ender_dragon", EnderDragonMeta::new);
supplier.put("minecraft:enderman", EndermanMeta::new);
supplier.put("minecraft:endermite", EndermiteMeta::new);
supplier.put("minecraft:evoker", EvokerMeta::new);
supplier.put("minecraft:evoker_fangs", EvokerFangsMeta::new);
supplier.put("minecraft:experience_orb", ExperienceOrbMeta::new);
supplier.put("minecraft:eye_of_ender", EyeOfEnderMeta::new);
supplier.put("minecraft:falling_block", FallingBlockMeta::new);
supplier.put("minecraft:firework_rocket", FireworkRocketMeta::new);
supplier.put("minecraft:fox", FoxMeta::new);
supplier.put("minecraft:ghast", GhastMeta::new);
supplier.put("minecraft:giant", GiantMeta::new);
supplier.put("minecraft:glow_item_frame", GlowItemFrameMeta::new);
supplier.put("minecraft:glow_squid", GlowSquidMeta::new);
supplier.put("minecraft:goat", GoatMeta::new);
supplier.put("minecraft:guardian", GuardianMeta::new);
supplier.put("minecraft:hoglin", HoglinMeta::new);
supplier.put("minecraft:horse", HorseMeta::new);
supplier.put("minecraft:illusioner", IllusionerMeta::new);
supplier.put("minecraft:iron_golem", IronGolemMeta::new);
supplier.put("minecraft:item", ItemEntityMeta::new);
supplier.put("minecraft:item_frame", ItemFrameMeta::new);
supplier.put("minecraft:fireball", FireballMeta::new);
supplier.put("minecraft:leash_knot", LeashKnotMeta::new);
supplier.put("minecraft:lightning_bolt", LightningBoltMeta::new);
supplier.put("minecraft:llama", LlamaMeta::new);
supplier.put("minecraft:llama_spit", LlamaSpitMeta::new);
supplier.put("minecraft:magma_cube", MagmaCubeMeta::new);
supplier.put("minecraft:marker", MarkerMeta::new);
supplier.put("minecraft:minecart", MinecartMeta::new);
supplier.put("minecraft:chest_minecart", ChestMinecartMeta::new);
supplier.put("minecraft:command_block_minecart", CommandBlockMinecartMeta::new);
supplier.put("minecraft:furnace_minecart", FurnaceMinecartMeta::new);
supplier.put("minecraft:hopper_minecart", HopperMinecartMeta::new);
supplier.put("minecraft:spawner_minecart", SpawnerMinecartMeta::new);
supplier.put("minecraft:tnt_minecart", TntMinecartMeta::new);
supplier.put("minecraft:mule", MuleMeta::new);
supplier.put("minecraft:mooshroom", MooshroomMeta::new);
supplier.put("minecraft:ocelot", OcelotMeta::new);
supplier.put("minecraft:painting", PaintingMeta::new);
supplier.put("minecraft:panda", PandaMeta::new);
supplier.put("minecraft:parrot", ParrotMeta::new);
supplier.put("minecraft:phantom", PhantomMeta::new);
supplier.put("minecraft:pig", PigMeta::new);
supplier.put("minecraft:piglin", PiglinMeta::new);
supplier.put("minecraft:piglin_brute", PiglinBruteMeta::new);
supplier.put("minecraft:pillager", PillagerMeta::new);
supplier.put("minecraft:polar_bear", PolarBearMeta::new);
supplier.put("minecraft:tnt", PrimedTntMeta::new);
supplier.put("minecraft:pufferfish", PufferfishMeta::new);
supplier.put("minecraft:rabbit", RabbitMeta::new);
supplier.put("minecraft:ravager", RavagerMeta::new);
supplier.put("minecraft:salmon", SalmonMeta::new);
supplier.put("minecraft:sheep", SheepMeta::new);
supplier.put("minecraft:shulker", ShulkerMeta::new);
supplier.put("minecraft:shulker_bullet", ShulkerBulletMeta::new);
supplier.put("minecraft:silverfish", SilverfishMeta::new);
supplier.put("minecraft:skeleton", SkeletonMeta::new);
supplier.put("minecraft:skeleton_horse", SkeletonHorseMeta::new);
supplier.put("minecraft:slime", SlimeMeta::new);
supplier.put("minecraft:small_fireball", SmallFireballMeta::new);
supplier.put("minecraft:snow_golem", SnowGolemMeta::new);
supplier.put("minecraft:snowball", SnowballMeta::new);
supplier.put("minecraft:spectral_arrow", SpectralArrowMeta::new);
supplier.put("minecraft:spider", SpiderMeta::new);
supplier.put("minecraft:squid", SquidMeta::new);
supplier.put("minecraft:stray", StrayMeta::new);
supplier.put("minecraft:strider", StriderMeta::new);
supplier.put("minecraft:egg", ThrownEggMeta::new);
supplier.put("minecraft:ender_pearl", ThrownEnderPearlMeta::new);
supplier.put("minecraft:experience_bottle", ThrownExperienceBottleMeta::new);
supplier.put("minecraft:potion", ThrownPotionMeta::new);
supplier.put("minecraft:trident", ThrownTridentMeta::new);
supplier.put("minecraft:trader_llama", TraderLlamaMeta::new);
supplier.put("minecraft:tropical_fish", TropicalFishMeta::new);
supplier.put("minecraft:turtle", TurtleMeta::new);
supplier.put("minecraft:vex", VexMeta::new);
supplier.put("minecraft:villager", VillagerMeta::new);
supplier.put("minecraft:vindicator", VindicatorMeta::new);
supplier.put("minecraft:wandering_trader", WanderingTraderMeta::new);
supplier.put("minecraft:witch", WitchMeta::new);
supplier.put("minecraft:wither", WitherMeta::new);
supplier.put("minecraft:wither_skeleton", WitherSkeletonMeta::new);
supplier.put("minecraft:wither_skull", WitherSkullMeta::new);
supplier.put("minecraft:wolf", WolfMeta::new);
supplier.put("minecraft:zoglin", ZoglinMeta::new);
supplier.put("minecraft:zombie", ZombieMeta::new);
supplier.put("minecraft:zombie_horse", ZombieHorseMeta::new);
supplier.put("minecraft:zombie_villager", ZombieVillagerMeta::new);
supplier.put("minecraft:zombified_piglin", ZombifiedPiglinMeta::new);
supplier.put("minecraft:player", PlayerMeta::new);
supplier.put("minecraft:fishing_bobber", FishingHookMeta::new);
return supplier;
}
private static Map<String, Double> createDragMap() {
Map<String, Double> result = new HashMap<>();
result.put("minecraft:boat", 0d);
result.put("minecraft:llama_spit", 0.01);
result.put("minecraft:ender_pearl", 0.01);
result.put("minecraft:potion", 0.01);
result.put("minecraft:snowball", 0.01);
result.put("minecraft:egg", 0.01);
result.put("minecraft:trident", 0.01);
result.put("minecraft:spectral_arrow", 0.01);
result.put("minecraft:arrow", 0.01);
result.put("minecraft:minecart", 0.05);
result.put("minecraft:fishing_bobber", 0.08);
return result;
}
private static Map<String, Double> createAccelerationMap() {
Map<String, Double> result = new HashMap<>();
result.put("minecraft:item_frame", 0d);
result.put("minecraft:egg", 0.03);
result.put("minecraft:fishing_bobber", 0.03);
result.put("minecraft:experience_bottle", 0.03);
result.put("minecraft:ender_pearl", 0.03);
result.put("minecraft:potion", 0.03);
result.put("minecraft:snowball", 0.03);
result.put("minecraft:boat", 0.04);
result.put("minecraft:tnt", 0.04);
result.put("minecraft:falling_block", 0.04);
result.put("minecraft:item", 0.04);
result.put("minecraft:minecart", 0.04);
result.put("minecraft:arrow", 0.05);
result.put("minecraft:spectral_arrow", 0.05);
result.put("minecraft:trident", 0.05);
result.put("minecraft:llama_spit", 0.06);
result.put("minecraft:fireball", 0.1);
result.put("minecraft:wither_skull", 0.1);
result.put("minecraft:dragon_fireball", 0.1);
return result;
}
private final Registry.EntityEntry registry;
EntityTypeImpl(Registry.EntityEntry registry) {

View File

@ -1,274 +0,0 @@
package net.minestom.server.entity;
import com.google.gson.JsonObject;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import net.minestom.server.entity.metadata.EntityMeta;
import net.minestom.server.entity.metadata.PlayerMeta;
import net.minestom.server.entity.metadata.ambient.BatMeta;
import net.minestom.server.entity.metadata.animal.*;
import net.minestom.server.entity.metadata.animal.tameable.CatMeta;
import net.minestom.server.entity.metadata.animal.tameable.ParrotMeta;
import net.minestom.server.entity.metadata.animal.tameable.WolfMeta;
import net.minestom.server.entity.metadata.arrow.ArrowMeta;
import net.minestom.server.entity.metadata.arrow.SpectralArrowMeta;
import net.minestom.server.entity.metadata.arrow.ThrownTridentMeta;
import net.minestom.server.entity.metadata.flying.GhastMeta;
import net.minestom.server.entity.metadata.flying.PhantomMeta;
import net.minestom.server.entity.metadata.golem.IronGolemMeta;
import net.minestom.server.entity.metadata.golem.ShulkerMeta;
import net.minestom.server.entity.metadata.golem.SnowGolemMeta;
import net.minestom.server.entity.metadata.item.*;
import net.minestom.server.entity.metadata.minecart.*;
import net.minestom.server.entity.metadata.monster.*;
import net.minestom.server.entity.metadata.monster.raider.*;
import net.minestom.server.entity.metadata.monster.skeleton.SkeletonMeta;
import net.minestom.server.entity.metadata.monster.skeleton.StrayMeta;
import net.minestom.server.entity.metadata.monster.skeleton.WitherSkeletonMeta;
import net.minestom.server.entity.metadata.monster.zombie.DrownedMeta;
import net.minestom.server.entity.metadata.monster.zombie.ZombieMeta;
import net.minestom.server.entity.metadata.monster.zombie.ZombieVillagerMeta;
import net.minestom.server.entity.metadata.monster.zombie.ZombifiedPiglinMeta;
import net.minestom.server.entity.metadata.other.*;
import net.minestom.server.entity.metadata.villager.VillagerMeta;
import net.minestom.server.entity.metadata.villager.WanderingTraderMeta;
import net.minestom.server.entity.metadata.water.AxolotlMeta;
import net.minestom.server.entity.metadata.water.DolphinMeta;
import net.minestom.server.entity.metadata.water.GlowSquidMeta;
import net.minestom.server.entity.metadata.water.SquidMeta;
import net.minestom.server.entity.metadata.water.fish.CodMeta;
import net.minestom.server.entity.metadata.water.fish.PufferfishMeta;
import net.minestom.server.entity.metadata.water.fish.SalmonMeta;
import net.minestom.server.entity.metadata.water.fish.TropicalFishMeta;
import net.minestom.server.registry.Registry;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.function.BiFunction;
@ApiStatus.Internal
final class EntityTypeLoader {
// Maps do not need to be thread-safe as they are fully populated
// in the static initializer, should not be modified during runtime
// Block namespace -> registry data
private static final Map<String, EntityType> NAMESPACE_MAP = new HashMap<>();
// Block id -> registry data
private static final Int2ObjectMap<EntityType> ENTITY_ID_MAP = new Int2ObjectOpenHashMap<>();
private static final Map<String, BiFunction<Entity, Metadata, EntityMeta>> ENTITY_META_SUPPLIER = createMetaMap();
private static final Map<String, Double> ACCELERATION_MAP = createAccelerationMap();
private static final Map<String, Double> DRAG_MAP = createDragMap();
static @Nullable EntityType get(@NotNull String namespace) {
if (namespace.indexOf(':') == -1) {
// Default to minecraft namespace
namespace = "minecraft:" + namespace;
}
return NAMESPACE_MAP.get(namespace);
}
static EntityType getId(int id) {
return ENTITY_ID_MAP.get(id);
}
static Collection<EntityType> values() {
return Collections.unmodifiableCollection(NAMESPACE_MAP.values());
}
static EntityMeta createMeta(EntityType entityType, Entity entity, Metadata metadata) {
return ENTITY_META_SUPPLIER.get(entityType.name()).apply(entity, metadata);
}
static double getAcceleration(String namespace) {
return ACCELERATION_MAP.getOrDefault(namespace, 0.08);
}
static double getDrag(String namespace) {
return DRAG_MAP.getOrDefault(namespace, 0.02);
}
static {
// Load data from file
JsonObject entities = Registry.load(Registry.Resource.ENTITIES);
entities.entrySet().forEach(entry -> {
final String namespace = entry.getKey();
final JsonObject entityObject = entry.getValue().getAsJsonObject();
final var entityType = new EntityTypeImpl(Registry.entity(namespace, entityObject, null));
ENTITY_ID_MAP.put(entityType.id(), entityType);
NAMESPACE_MAP.put(namespace, entityType);
});
}
private static Map<String, BiFunction<Entity, Metadata, EntityMeta>> createMetaMap() {
Map<String, BiFunction<Entity, Metadata, EntityMeta>> supplier = new HashMap<>();
supplier.put("minecraft:area_effect_cloud", AreaEffectCloudMeta::new);
supplier.put("minecraft:armor_stand", ArmorStandMeta::new);
supplier.put("minecraft:arrow", ArrowMeta::new);
supplier.put("minecraft:axolotl", AxolotlMeta::new);
supplier.put("minecraft:bat", BatMeta::new);
supplier.put("minecraft:bee", BeeMeta::new);
supplier.put("minecraft:boat", BoatMeta::new);
supplier.put("minecraft:cat", CatMeta::new);
supplier.put("minecraft:cave_spider", CaveSpiderMeta::new);
supplier.put("minecraft:chicken", ChickenMeta::new);
supplier.put("minecraft:cod", CodMeta::new);
supplier.put("minecraft:cow", CowMeta::new);
supplier.put("minecraft:creeper", CreeperMeta::new);
supplier.put("minecraft:dolphin", DolphinMeta::new);
supplier.put("minecraft:donkey", DonkeyMeta::new);
supplier.put("minecraft:dragon_fireball", DragonFireballMeta::new);
supplier.put("minecraft:drowned", DrownedMeta::new);
supplier.put("minecraft:elder_guardian", ElderGuardianMeta::new);
supplier.put("minecraft:end_crystal", EndCrystalMeta::new);
supplier.put("minecraft:ender_dragon", EnderDragonMeta::new);
supplier.put("minecraft:enderman", EndermanMeta::new);
supplier.put("minecraft:endermite", EndermiteMeta::new);
supplier.put("minecraft:evoker", EvokerMeta::new);
supplier.put("minecraft:evoker_fangs", EvokerFangsMeta::new);
supplier.put("minecraft:experience_orb", ExperienceOrbMeta::new);
supplier.put("minecraft:eye_of_ender", EyeOfEnderMeta::new);
supplier.put("minecraft:falling_block", FallingBlockMeta::new);
supplier.put("minecraft:firework_rocket", FireworkRocketMeta::new);
supplier.put("minecraft:fox", FoxMeta::new);
supplier.put("minecraft:ghast", GhastMeta::new);
supplier.put("minecraft:giant", GiantMeta::new);
supplier.put("minecraft:glow_item_frame", GlowItemFrameMeta::new);
supplier.put("minecraft:glow_squid", GlowSquidMeta::new);
supplier.put("minecraft:goat", GoatMeta::new);
supplier.put("minecraft:guardian", GuardianMeta::new);
supplier.put("minecraft:hoglin", HoglinMeta::new);
supplier.put("minecraft:horse", HorseMeta::new);
supplier.put("minecraft:illusioner", IllusionerMeta::new);
supplier.put("minecraft:iron_golem", IronGolemMeta::new);
supplier.put("minecraft:item", ItemEntityMeta::new);
supplier.put("minecraft:item_frame", ItemFrameMeta::new);
supplier.put("minecraft:fireball", FireballMeta::new);
supplier.put("minecraft:leash_knot", LeashKnotMeta::new);
supplier.put("minecraft:lightning_bolt", LightningBoltMeta::new);
supplier.put("minecraft:llama", LlamaMeta::new);
supplier.put("minecraft:llama_spit", LlamaSpitMeta::new);
supplier.put("minecraft:magma_cube", MagmaCubeMeta::new);
supplier.put("minecraft:marker", MarkerMeta::new);
supplier.put("minecraft:minecart", MinecartMeta::new);
supplier.put("minecraft:chest_minecart", ChestMinecartMeta::new);
supplier.put("minecraft:command_block_minecart", CommandBlockMinecartMeta::new);
supplier.put("minecraft:furnace_minecart", FurnaceMinecartMeta::new);
supplier.put("minecraft:hopper_minecart", HopperMinecartMeta::new);
supplier.put("minecraft:spawner_minecart", SpawnerMinecartMeta::new);
supplier.put("minecraft:tnt_minecart", TntMinecartMeta::new);
supplier.put("minecraft:mule", MuleMeta::new);
supplier.put("minecraft:mooshroom", MooshroomMeta::new);
supplier.put("minecraft:ocelot", OcelotMeta::new);
supplier.put("minecraft:painting", PaintingMeta::new);
supplier.put("minecraft:panda", PandaMeta::new);
supplier.put("minecraft:parrot", ParrotMeta::new);
supplier.put("minecraft:phantom", PhantomMeta::new);
supplier.put("minecraft:pig", PigMeta::new);
supplier.put("minecraft:piglin", PiglinMeta::new);
supplier.put("minecraft:piglin_brute", PiglinBruteMeta::new);
supplier.put("minecraft:pillager", PillagerMeta::new);
supplier.put("minecraft:polar_bear", PolarBearMeta::new);
supplier.put("minecraft:tnt", PrimedTntMeta::new);
supplier.put("minecraft:pufferfish", PufferfishMeta::new);
supplier.put("minecraft:rabbit", RabbitMeta::new);
supplier.put("minecraft:ravager", RavagerMeta::new);
supplier.put("minecraft:salmon", SalmonMeta::new);
supplier.put("minecraft:sheep", SheepMeta::new);
supplier.put("minecraft:shulker", ShulkerMeta::new);
supplier.put("minecraft:shulker_bullet", ShulkerBulletMeta::new);
supplier.put("minecraft:silverfish", SilverfishMeta::new);
supplier.put("minecraft:skeleton", SkeletonMeta::new);
supplier.put("minecraft:skeleton_horse", SkeletonHorseMeta::new);
supplier.put("minecraft:slime", SlimeMeta::new);
supplier.put("minecraft:small_fireball", SmallFireballMeta::new);
supplier.put("minecraft:snow_golem", SnowGolemMeta::new);
supplier.put("minecraft:snowball", SnowballMeta::new);
supplier.put("minecraft:spectral_arrow", SpectralArrowMeta::new);
supplier.put("minecraft:spider", SpiderMeta::new);
supplier.put("minecraft:squid", SquidMeta::new);
supplier.put("minecraft:stray", StrayMeta::new);
supplier.put("minecraft:strider", StriderMeta::new);
supplier.put("minecraft:egg", ThrownEggMeta::new);
supplier.put("minecraft:ender_pearl", ThrownEnderPearlMeta::new);
supplier.put("minecraft:experience_bottle", ThrownExperienceBottleMeta::new);
supplier.put("minecraft:potion", ThrownPotionMeta::new);
supplier.put("minecraft:trident", ThrownTridentMeta::new);
supplier.put("minecraft:trader_llama", TraderLlamaMeta::new);
supplier.put("minecraft:tropical_fish", TropicalFishMeta::new);
supplier.put("minecraft:turtle", TurtleMeta::new);
supplier.put("minecraft:vex", VexMeta::new);
supplier.put("minecraft:villager", VillagerMeta::new);
supplier.put("minecraft:vindicator", VindicatorMeta::new);
supplier.put("minecraft:wandering_trader", WanderingTraderMeta::new);
supplier.put("minecraft:witch", WitchMeta::new);
supplier.put("minecraft:wither", WitherMeta::new);
supplier.put("minecraft:wither_skeleton", WitherSkeletonMeta::new);
supplier.put("minecraft:wither_skull", WitherSkullMeta::new);
supplier.put("minecraft:wolf", WolfMeta::new);
supplier.put("minecraft:zoglin", ZoglinMeta::new);
supplier.put("minecraft:zombie", ZombieMeta::new);
supplier.put("minecraft:zombie_horse", ZombieHorseMeta::new);
supplier.put("minecraft:zombie_villager", ZombieVillagerMeta::new);
supplier.put("minecraft:zombified_piglin", ZombifiedPiglinMeta::new);
supplier.put("minecraft:player", PlayerMeta::new);
supplier.put("minecraft:fishing_bobber", FishingHookMeta::new);
return supplier;
}
private static Map<String, Double> createDragMap() {
Map<String, Double> result = new HashMap<>();
result.put("minecraft:boat", 0d);
result.put("minecraft:llama_spit", 0.01);
result.put("minecraft:ender_pearl", 0.01);
result.put("minecraft:potion", 0.01);
result.put("minecraft:snowball", 0.01);
result.put("minecraft:egg", 0.01);
result.put("minecraft:trident", 0.01);
result.put("minecraft:spectral_arrow", 0.01);
result.put("minecraft:arrow", 0.01);
result.put("minecraft:minecart", 0.05);
result.put("minecraft:fishing_bobber", 0.08);
return result;
}
private static Map<String, Double> createAccelerationMap() {
Map<String, Double> result = new HashMap<>();
result.put("minecraft:item_frame", 0d);
result.put("minecraft:egg", 0.03);
result.put("minecraft:fishing_bobber", 0.03);
result.put("minecraft:experience_bottle", 0.03);
result.put("minecraft:ender_pearl", 0.03);
result.put("minecraft:potion", 0.03);
result.put("minecraft:snowball", 0.03);
result.put("minecraft:boat", 0.04);
result.put("minecraft:tnt", 0.04);
result.put("minecraft:falling_block", 0.04);
result.put("minecraft:item", 0.04);
result.put("minecraft:minecart", 0.04);
result.put("minecraft:arrow", 0.05);
result.put("minecraft:spectral_arrow", 0.05);
result.put("minecraft:trident", 0.05);
result.put("minecraft:llama_spit", 0.06);
result.put("minecraft:fireball", 0.1);
result.put("minecraft:wither_skull", 0.1);
result.put("minecraft:dragon_fireball", 0.1);
return result;
}
}

View File

@ -32,11 +32,11 @@ public interface Enchantment extends ProtocolObject, EnchantmentConstants {
}
static @NotNull Collection<@NotNull Enchantment> values() {
return EnchantmentLoader.values();
return EnchantmentImpl.values();
}
static @Nullable Enchantment fromNamespaceId(@NotNull String namespaceID) {
return EnchantmentLoader.get(namespaceID);
return EnchantmentImpl.get(namespaceID);
}
static @Nullable Enchantment fromNamespaceId(@NotNull NamespaceID namespaceID) {
@ -44,6 +44,6 @@ public interface Enchantment extends ProtocolObject, EnchantmentConstants {
}
static @Nullable Enchantment fromId(int id) {
return EnchantmentLoader.getId(id);
return EnchantmentImpl.getId(id);
}
}

View File

@ -1,9 +1,40 @@
package net.minestom.server.item;
import com.google.gson.JsonObject;
import net.minestom.server.registry.Registry;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
final class EnchantmentImpl implements Enchantment {
private static final Registry.Loader<Enchantment> LOADER = new Registry.Loader<>();
static Enchantment get(@NotNull String namespace) {
return LOADER.get(namespace);
}
static Enchantment getSafe(@NotNull String namespace) {
return LOADER.getSafe(namespace);
}
static Enchantment getId(int id) {
return LOADER.getId(id);
}
static Collection<Enchantment> values() {
return LOADER.values();
}
static {
// Load data from file
JsonObject enchantments = Registry.load(Registry.Resource.ENCHANTMENTS);
enchantments.entrySet().forEach(entry -> {
final String namespace = entry.getKey();
final JsonObject enchantmentObject = entry.getValue().getAsJsonObject();
LOADER.register(new EnchantmentImpl(Registry.enchantment(namespace, enchantmentObject, null)));
});
}
private final Registry.EnchantmentEntry registry;
EnchantmentImpl(Registry.EnchantmentEntry registry) {

View File

@ -1,54 +0,0 @@
package net.minestom.server.item;
import com.google.gson.JsonObject;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import net.minestom.server.registry.Registry;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@ApiStatus.Internal
final class EnchantmentLoader {
// Maps do not need to be thread-safe as they are fully populated
// in the static initializer, should not be modified during runtime
// Block namespace -> registry data
private static final Map<String, Enchantment> NAMESPACE_MAP = new HashMap<>();
// Block id -> registry data
private static final Int2ObjectMap<Enchantment> ID_MAP = new Int2ObjectOpenHashMap<>();
static Enchantment get(@NotNull String namespace) {
if (namespace.indexOf(':') == -1) {
// Default to minecraft namespace
namespace = "minecraft:" + namespace;
}
return NAMESPACE_MAP.get(namespace);
}
static Enchantment getId(int id) {
return ID_MAP.get(id);
}
static Collection<Enchantment> values() {
return Collections.unmodifiableCollection(NAMESPACE_MAP.values());
}
static {
// Load data from file
JsonObject enchantments = Registry.load(Registry.Resource.ENCHANTMENTS);
enchantments.entrySet().forEach(entry -> {
final String namespace = entry.getKey();
final JsonObject enchantmentObject = entry.getValue().getAsJsonObject();
final var enchantment = new EnchantmentImpl(Registry.enchantment(namespace, enchantmentObject, null));
ID_MAP.put(enchantment.id(), enchantment);
NAMESPACE_MAP.put(namespace, enchantment);
});
}
}

View File

@ -61,11 +61,11 @@ public interface Material extends ProtocolObject, MaterialConstants {
}
static @NotNull Collection<@NotNull Material> values() {
return MaterialLoader.values();
return MaterialImpl.values();
}
static @Nullable Material fromNamespaceId(@NotNull String namespaceID) {
return MaterialLoader.get(namespaceID);
return MaterialImpl.get(namespaceID);
}
static @Nullable Material fromNamespaceId(@NotNull NamespaceID namespaceID) {
@ -73,6 +73,6 @@ public interface Material extends ProtocolObject, MaterialConstants {
}
static @Nullable Material fromId(int id) {
return MaterialLoader.getId(id);
return MaterialImpl.getId(id);
}
}

View File

@ -1,9 +1,40 @@
package net.minestom.server.item;
import com.google.gson.JsonObject;
import net.minestom.server.registry.Registry;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
final class MaterialImpl implements Material {
private static final Registry.Loader<Material> LOADER = new Registry.Loader<>();
static Material get(@NotNull String namespace) {
return LOADER.get(namespace);
}
static Material getSafe(@NotNull String namespace) {
return LOADER.getSafe(namespace);
}
static Material getId(int id) {
return LOADER.getId(id);
}
static Collection<Material> values() {
return LOADER.values();
}
static {
// Load data from file
JsonObject materials = Registry.load(Registry.Resource.ITEMS);
materials.entrySet().forEach(entry -> {
final String namespace = entry.getKey();
final JsonObject materialObject = entry.getValue().getAsJsonObject();
LOADER.register(new MaterialImpl(Registry.material(namespace, materialObject, null)));
});
}
private final Registry.MaterialEntry registry;
MaterialImpl(Registry.MaterialEntry registry) {

View File

@ -1,57 +0,0 @@
package net.minestom.server.item;
import com.google.gson.JsonObject;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import net.minestom.server.registry.Registry;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/**
* Loads {@link net.minestom.server.item.Material materials} from file.
*/
@ApiStatus.Internal
final class MaterialLoader {
// Maps do not need to be thread-safe as they are fully populated
// in the static initializer, should not be modified during runtime
// Block namespace -> registry data
private static final Map<String, Material> NAMESPACE_MAP = new HashMap<>();
// Block id -> registry data
private static final Int2ObjectMap<Material> MATERIAL_ID_MAP = new Int2ObjectOpenHashMap<>();
static Material get(@NotNull String namespace) {
if (namespace.indexOf(':') == -1) {
// Default to minecraft namespace
namespace = "minecraft:" + namespace;
}
return NAMESPACE_MAP.get(namespace);
}
static Material getId(int id) {
return MATERIAL_ID_MAP.get(id);
}
static Collection<Material> values() {
return Collections.unmodifiableCollection(NAMESPACE_MAP.values());
}
static {
// Load data from file
JsonObject materials = Registry.load(Registry.Resource.ITEMS);
materials.entrySet().forEach(entry -> {
final String namespace = entry.getKey();
final JsonObject materialObject = entry.getValue().getAsJsonObject();
final Material material = new MaterialImpl(Registry.material(namespace, materialObject, null));
MATERIAL_ID_MAP.put(material.id(), material);
NAMESPACE_MAP.put(namespace, material);
});
}
}

View File

@ -12,11 +12,11 @@ import java.util.Collection;
public interface Particle extends ProtocolObject, ParticleConstants {
static @NotNull Collection<@NotNull Particle> values() {
return ParticleLoader.values();
return ParticleImpl.values();
}
static @Nullable Particle fromNamespaceId(@NotNull String namespaceID) {
return ParticleLoader.get(namespaceID);
return ParticleImpl.get(namespaceID);
}
static @Nullable Particle fromNamespaceId(@NotNull NamespaceID namespaceID) {
@ -24,6 +24,6 @@ public interface Particle extends ProtocolObject, ParticleConstants {
}
static @Nullable Particle fromId(int id) {
return ParticleLoader.getId(id);
return ParticleImpl.getId(id);
}
}

View File

@ -1,9 +1,42 @@
package net.minestom.server.particle;
import com.google.gson.JsonObject;
import net.minestom.server.registry.Registry;
import net.minestom.server.utils.NamespaceID;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
final class ParticleImpl implements Particle {
private static final Registry.Loader<Particle> LOADER = new Registry.Loader<>();
static Particle get(@NotNull String namespace) {
return LOADER.get(namespace);
}
static Particle getSafe(@NotNull String namespace) {
return LOADER.getSafe(namespace);
}
static Particle getId(int id) {
return LOADER.getId(id);
}
static Collection<Particle> values() {
return LOADER.values();
}
static {
// Load data from file
JsonObject particles = Registry.load(Registry.Resource.PARTICLES);
particles.entrySet().forEach(entry -> {
final String namespace = entry.getKey();
final JsonObject object = entry.getValue().getAsJsonObject();
final int id = object.get("id").getAsInt();
LOADER.register(new ParticleImpl(NamespaceID.from(namespace), id));
});
}
private final NamespaceID namespaceID;
private final int id;

View File

@ -1,56 +0,0 @@
package net.minestom.server.particle;
import com.google.gson.JsonObject;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import net.minestom.server.registry.Registry;
import net.minestom.server.utils.NamespaceID;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@ApiStatus.Internal
final class ParticleLoader {
// Maps do not need to be thread-safe as they are fully populated
// in the static initializer, should not be modified during runtime
// Block namespace -> registry data
private static final Map<String, Particle> NAMESPACE_MAP = new HashMap<>();
// Block id -> registry data
private static final Int2ObjectMap<Particle> ID_MAP = new Int2ObjectOpenHashMap<>();
static Particle get(@NotNull String namespace) {
if (namespace.indexOf(':') == -1) {
// Default to minecraft namespace
namespace = "minecraft:" + namespace;
}
return NAMESPACE_MAP.get(namespace);
}
static Particle getId(int id) {
return ID_MAP.get(id);
}
static Collection<Particle> values() {
return Collections.unmodifiableCollection(NAMESPACE_MAP.values());
}
static {
// Load data from file
JsonObject particles = Registry.load(Registry.Resource.PARTICLES);
particles.entrySet().forEach(entry -> {
final String namespace = entry.getKey();
final JsonObject object = entry.getValue().getAsJsonObject();
final int id = object.get("id").getAsInt();
final var particle = new ParticleImpl(NamespaceID.from(namespace), id);
ID_MAP.put(id, particle);
NAMESPACE_MAP.put(namespace, particle);
});
}
}

View File

@ -27,11 +27,11 @@ public interface PotionEffect extends ProtocolObject, PotionEffectConstants {
}
static @NotNull Collection<@NotNull PotionEffect> values() {
return PotionEffectLoader.values();
return PotionEffectImpl.values();
}
static @Nullable PotionEffect fromNamespaceId(@NotNull String namespaceID) {
return PotionEffectLoader.get(namespaceID);
return PotionEffectImpl.get(namespaceID);
}
static @Nullable PotionEffect fromNamespaceId(@NotNull NamespaceID namespaceID) {
@ -39,6 +39,6 @@ public interface PotionEffect extends ProtocolObject, PotionEffectConstants {
}
static @Nullable PotionEffect fromId(int id) {
return PotionEffectLoader.getId(id);
return PotionEffectImpl.getId(id);
}
}

View File

@ -1,9 +1,40 @@
package net.minestom.server.potion;
import com.google.gson.JsonObject;
import net.minestom.server.registry.Registry;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
final class PotionEffectImpl implements PotionEffect {
private static final Registry.Loader<PotionEffect> LOADER = new Registry.Loader<>();
static PotionEffect get(@NotNull String namespace) {
return LOADER.get(namespace);
}
static PotionEffect getSafe(@NotNull String namespace) {
return LOADER.getSafe(namespace);
}
static PotionEffect getId(int id) {
return LOADER.getId(id);
}
static Collection<PotionEffect> values() {
return LOADER.values();
}
static {
// Load data from file
JsonObject potionEffects = Registry.load(Registry.Resource.POTION_EFFECTS);
potionEffects.entrySet().forEach(entry -> {
final String namespace = entry.getKey();
final JsonObject object = entry.getValue().getAsJsonObject();
LOADER.register(new PotionEffectImpl(Registry.potionEffect(namespace, object, null)));
});
}
private final Registry.PotionEffectEntry registry;
PotionEffectImpl(Registry.PotionEffectEntry registry) {

View File

@ -1,54 +0,0 @@
package net.minestom.server.potion;
import com.google.gson.JsonObject;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import net.minestom.server.registry.Registry;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@ApiStatus.Internal
final class PotionEffectLoader {
// Maps do not need to be thread-safe as they are fully populated
// in the static initializer, should not be modified during runtime
// Block namespace -> registry data
private static final Map<String, PotionEffect> NAMESPACE_MAP = new HashMap<>();
// Block id -> registry data
private static final Int2ObjectMap<PotionEffect> ID_MAP = new Int2ObjectOpenHashMap<>();
static PotionEffect get(@NotNull String namespace) {
if (namespace.indexOf(':') == -1) {
// Default to minecraft namespace
namespace = "minecraft:" + namespace;
}
return NAMESPACE_MAP.get(namespace);
}
static PotionEffect getId(int id) {
return ID_MAP.get(id);
}
static Collection<PotionEffect> values() {
return Collections.unmodifiableCollection(NAMESPACE_MAP.values());
}
static {
// Load data from file
JsonObject potionEffects = Registry.load(Registry.Resource.POTION_EFFECTS);
potionEffects.entrySet().forEach(entry -> {
final String namespace = entry.getKey();
final JsonObject object = entry.getValue().getAsJsonObject();
final var potionEffect = new PotionEffectImpl(Registry.potionEffect(namespace, object, null));
ID_MAP.put(potionEffect.id(), potionEffect);
NAMESPACE_MAP.put(namespace, potionEffect);
});
}
}

View File

@ -12,11 +12,11 @@ import java.util.Collection;
public interface PotionType extends ProtocolObject, PotionTypeConstants {
static @NotNull Collection<@NotNull PotionType> values() {
return PotionTypeLoader.values();
return PotionTypeImpl.values();
}
static @Nullable PotionType fromNamespaceId(@NotNull String namespaceID) {
return PotionTypeLoader.get(namespaceID);
return PotionTypeImpl.get(namespaceID);
}
static @Nullable PotionType fromNamespaceId(@NotNull NamespaceID namespaceID) {
@ -24,6 +24,6 @@ public interface PotionType extends ProtocolObject, PotionTypeConstants {
}
static @Nullable PotionType fromId(int id) {
return PotionTypeLoader.getId(id);
return PotionTypeImpl.getId(id);
}
}

View File

@ -1,9 +1,42 @@
package net.minestom.server.potion;
import com.google.gson.JsonObject;
import net.minestom.server.registry.Registry;
import net.minestom.server.utils.NamespaceID;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
final class PotionTypeImpl implements PotionType {
private static final Registry.Loader<PotionType> LOADER = new Registry.Loader<>();
static PotionType get(@NotNull String namespace) {
return LOADER.get(namespace);
}
static PotionType getSafe(@NotNull String namespace) {
return LOADER.getSafe(namespace);
}
static PotionType getId(int id) {
return LOADER.getId(id);
}
static Collection<PotionType> values() {
return LOADER.values();
}
static {
// Load data from file
JsonObject potionTypes = Registry.load(Registry.Resource.POTION_TYPES);
potionTypes.entrySet().forEach(entry -> {
final String namespace = entry.getKey();
final JsonObject object = entry.getValue().getAsJsonObject();
final int id = object.get("id").getAsInt();
LOADER.register(new PotionTypeImpl(NamespaceID.from(namespace), id));
});
}
private final NamespaceID namespaceID;
private final int id;

View File

@ -1,56 +0,0 @@
package net.minestom.server.potion;
import com.google.gson.JsonObject;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import net.minestom.server.registry.Registry;
import net.minestom.server.utils.NamespaceID;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@ApiStatus.Internal
final class PotionTypeLoader {
// Maps do not need to be thread-safe as they are fully populated
// in the static initializer, should not be modified during runtime
// Block namespace -> registry data
private static final Map<String, PotionType> NAMESPACE_MAP = new HashMap<>();
// Block id -> registry data
private static final Int2ObjectMap<PotionType> ID_MAP = new Int2ObjectOpenHashMap<>();
static PotionType get(@NotNull String namespace) {
if (namespace.indexOf(':') == -1) {
// Default to minecraft namespace
namespace = "minecraft:" + namespace;
}
return NAMESPACE_MAP.get(namespace);
}
static PotionType getId(int id) {
return ID_MAP.get(id);
}
static Collection<PotionType> values() {
return Collections.unmodifiableCollection(NAMESPACE_MAP.values());
}
static {
// Load data from file
JsonObject potionTypes = Registry.load(Registry.Resource.POTION_TYPES);
potionTypes.entrySet().forEach(entry -> {
final String namespace = entry.getKey();
final JsonObject object = entry.getValue().getAsJsonObject();
final int id = object.get("id").getAsInt();
final var potionType = new PotionTypeImpl(NamespaceID.from(namespace), id);
ID_MAP.put(id, potionType);
NAMESPACE_MAP.put(namespace, potionType);
});
}
}

View File

@ -4,6 +4,8 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import net.minestom.server.entity.EntitySpawnType;
import net.minestom.server.entity.EquipmentSlot;
import net.minestom.server.instance.block.Block;
@ -14,7 +16,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.InputStreamReader;
import java.util.Locale;
import java.util.*;
import java.util.function.Supplier;
@ApiStatus.Internal
@ -47,6 +49,37 @@ public class Registry {
return GSON.fromJson(new InputStreamReader(resourceStream), JsonObject.class);
}
public static class Loader<T extends ProtocolObject> {
// Maps do not need to be thread-safe as they are fully populated
// in the static initializer, should not be modified during runtime
// namespace -> registry data
private final Map<String, T> namespaceMap = new HashMap<>();
// id -> registry data
private final Int2ObjectMap<T> idMap = new Int2ObjectOpenHashMap<>();
public T get(@NotNull String namespace) {
return namespaceMap.get(namespace);
}
public T getSafe(@NotNull String namespace) {
return get(namespace.contains(":") ? namespace : "minecraft:" + namespace);
}
public T getId(int id) {
return idMap.get(id);
}
public Collection<T> values() {
return Collections.unmodifiableCollection(namespaceMap.values());
}
public void register(@NotNull T value) {
idMap.put(value.id(), value);
namespaceMap.put(value.name(), value);
}
}
public enum Resource {
BLOCKS("blocks"),
ITEMS("items"),

View File

@ -12,11 +12,11 @@ import java.util.Collection;
public interface SoundEvent extends ProtocolObject, SoundEventConstants {
static @NotNull Collection<@NotNull SoundEvent> values() {
return SoundEventLoader.values();
return SoundEventImpl.values();
}
static @Nullable SoundEvent fromNamespaceId(@NotNull String namespaceID) {
return SoundEventLoader.get(namespaceID);
return SoundEventImpl.get(namespaceID);
}
static @Nullable SoundEvent fromNamespaceId(@NotNull NamespaceID namespaceID) {
@ -24,6 +24,6 @@ public interface SoundEvent extends ProtocolObject, SoundEventConstants {
}
static @Nullable SoundEvent fromId(int id) {
return SoundEventLoader.getId(id);
return SoundEventImpl.getId(id);
}
}

View File

@ -1,9 +1,41 @@
package net.minestom.server.sound;
import com.google.gson.JsonObject;
import net.minestom.server.registry.Registry;
import net.minestom.server.utils.NamespaceID;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
final class SoundEventImpl implements SoundEvent {
private static final Registry.Loader<SoundEvent> LOADER = new Registry.Loader<>();
static SoundEvent get(@NotNull String namespace) {
return LOADER.get(namespace);
}
static SoundEvent getSafe(@NotNull String namespace) {
return LOADER.getSafe(namespace);
}
static SoundEvent getId(int id) {
return LOADER.getId(id);
}
static Collection<SoundEvent> values() {
return LOADER.values();
}
static {
// Load data from file
JsonObject sounds = Registry.load(Registry.Resource.SOUNDS);
sounds.entrySet().forEach(entry -> {
final String namespace = entry.getKey();
final JsonObject object = entry.getValue().getAsJsonObject();
final int id = object.get("id").getAsInt();
LOADER.register(new SoundEventImpl(NamespaceID.from(namespace), id));
});
}
private final NamespaceID namespaceID;
private final int id;

View File

@ -1,56 +0,0 @@
package net.minestom.server.sound;
import com.google.gson.JsonObject;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import net.minestom.server.registry.Registry;
import net.minestom.server.utils.NamespaceID;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@ApiStatus.Internal
final class SoundEventLoader {
// Maps do not need to be thread-safe as they are fully populated
// in the static initializer, should not be modified during runtime
// Block namespace -> registry data
private static final Map<String, SoundEvent> NAMESPACE_MAP = new HashMap<>();
// Block id -> registry data
private static final Int2ObjectMap<SoundEvent> ID_MAP = new Int2ObjectOpenHashMap<>();
static SoundEvent get(@NotNull String namespace) {
if (namespace.indexOf(':') == -1) {
// Default to minecraft namespace
namespace = "minecraft:" + namespace;
}
return NAMESPACE_MAP.get(namespace);
}
static SoundEvent getId(int id) {
return ID_MAP.get(id);
}
static Collection<SoundEvent> values() {
return Collections.unmodifiableCollection(NAMESPACE_MAP.values());
}
static {
// Load data from file
JsonObject sounds = Registry.load(Registry.Resource.SOUNDS);
sounds.entrySet().forEach(entry -> {
final String namespace = entry.getKey();
final JsonObject object = entry.getValue().getAsJsonObject();
final int id = object.get("id").getAsInt();
final var soundEvent = new SoundEventImpl(NamespaceID.from(namespace), id);
ID_MAP.put(id, soundEvent);
NAMESPACE_MAP.put(namespace, soundEvent);
});
}
}

View File

@ -12,11 +12,11 @@ import java.util.Collection;
public interface StatisticType extends ProtocolObject, StatisticTypeConstants {
static @NotNull Collection<@NotNull StatisticType> values() {
return StatisticTypeLoader.values();
return StatisticTypeImpl.values();
}
static @Nullable StatisticType fromNamespaceId(@NotNull String namespaceID) {
return StatisticTypeLoader.get(namespaceID);
return StatisticTypeImpl.getSafe(namespaceID);
}
static @Nullable StatisticType fromNamespaceId(@NotNull NamespaceID namespaceID) {
@ -24,6 +24,6 @@ public interface StatisticType extends ProtocolObject, StatisticTypeConstants {
}
static @Nullable StatisticType fromId(int id) {
return StatisticTypeLoader.getId(id);
return StatisticTypeImpl.getId(id);
}
}

View File

@ -1,9 +1,42 @@
package net.minestom.server.statistic;
import com.google.gson.JsonObject;
import net.minestom.server.registry.Registry;
import net.minestom.server.utils.NamespaceID;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
final class StatisticTypeImpl implements StatisticType {
private static final Registry.Loader<StatisticType> LOADER = new Registry.Loader<>();
static StatisticType get(@NotNull String namespace) {
return LOADER.get(namespace);
}
static StatisticType getSafe(@NotNull String namespace) {
return LOADER.getSafe(namespace);
}
static StatisticType getId(int id) {
return LOADER.getId(id);
}
static Collection<StatisticType> values() {
return LOADER.values();
}
static {
// Load data from file
JsonObject statistics = Registry.load(Registry.Resource.STATISTICS);
statistics.entrySet().forEach(entry -> {
final String namespace = entry.getKey();
final JsonObject object = entry.getValue().getAsJsonObject();
final int id = object.get("id").getAsInt();
LOADER.register(new StatisticTypeImpl(NamespaceID.from(namespace), id));
});
}
private final NamespaceID namespaceID;
private final int id;

View File

@ -1,56 +0,0 @@
package net.minestom.server.statistic;
import com.google.gson.JsonObject;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import net.minestom.server.registry.Registry;
import net.minestom.server.utils.NamespaceID;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@ApiStatus.Internal
final class StatisticTypeLoader {
// Maps do not need to be thread-safe as they are fully populated
// in the static initializer, should not be modified during runtime
// Block namespace -> registry data
private static final Map<String, StatisticType> NAMESPACE_MAP = new HashMap<>();
// Block id -> registry data
private static final Int2ObjectMap<StatisticType> ID_MAP = new Int2ObjectOpenHashMap<>();
static StatisticType get(@NotNull String namespace) {
if (namespace.indexOf(':') == -1) {
// Default to minecraft namespace
namespace = "minecraft:" + namespace;
}
return NAMESPACE_MAP.get(namespace);
}
static StatisticType getId(int id) {
return ID_MAP.get(id);
}
static Collection<StatisticType> values() {
return Collections.unmodifiableCollection(NAMESPACE_MAP.values());
}
static {
// Load data from file
JsonObject statistics = Registry.load(Registry.Resource.STATISTICS);
statistics.entrySet().forEach(entry -> {
final String namespace = entry.getKey();
final JsonObject object = entry.getValue().getAsJsonObject();
final int id = object.get("id").getAsInt();
final var statisticType = new StatisticTypeImpl(NamespaceID.from(namespace), id);
ID_MAP.put(id, statisticType);
NAMESPACE_MAP.put(namespace, statisticType);
});
}
}