mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-31 21:48:08 +01:00
EntitySpawnType initial commit
This commit is contained in:
parent
49c92883cd
commit
7db7dab4b9
@ -35,6 +35,15 @@ 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.EyeOfEnderMeta;
|
||||
import net.minestom.server.entity.metadata.item.FireballMeta;
|
||||
import net.minestom.server.entity.metadata.item.ItemEntityMeta;
|
||||
import net.minestom.server.entity.metadata.item.SmallFireballMeta;
|
||||
import net.minestom.server.entity.metadata.item.SnowballMeta;
|
||||
import net.minestom.server.entity.metadata.item.ThrownEggMeta;
|
||||
import net.minestom.server.entity.metadata.item.ThrownEnderPearlMeta;
|
||||
import net.minestom.server.entity.metadata.item.ThrownExperienceBottleMeta;
|
||||
import net.minestom.server.entity.metadata.item.ThrownPotionMeta;
|
||||
import net.minestom.server.entity.metadata.minecart.ChestMinecartMeta;
|
||||
import net.minestom.server.entity.metadata.minecart.CommandBlockMinecartMeta;
|
||||
import net.minestom.server.entity.metadata.minecart.FurnaceMinecartMeta;
|
||||
@ -71,15 +80,6 @@ import net.minestom.server.entity.metadata.monster.zombie.HuskMeta;
|
||||
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.object.EyeOfEnderMeta;
|
||||
import net.minestom.server.entity.metadata.object.FireballMeta;
|
||||
import net.minestom.server.entity.metadata.object.ItemEntityMeta;
|
||||
import net.minestom.server.entity.metadata.object.SmallFireballMeta;
|
||||
import net.minestom.server.entity.metadata.object.SnowballMeta;
|
||||
import net.minestom.server.entity.metadata.object.ThrownEggMeta;
|
||||
import net.minestom.server.entity.metadata.object.ThrownEnderPearlMeta;
|
||||
import net.minestom.server.entity.metadata.object.ThrownExperienceBottleMeta;
|
||||
import net.minestom.server.entity.metadata.object.ThrownPotionMeta;
|
||||
import net.minestom.server.entity.metadata.other.AreaEffectCloudMeta;
|
||||
import net.minestom.server.entity.metadata.other.ArmorStandMeta;
|
||||
import net.minestom.server.entity.metadata.other.BoatMeta;
|
||||
@ -121,221 +121,221 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
@SuppressWarnings({"deprecation"})
|
||||
public enum EntityType {
|
||||
AREA_EFFECT_CLOUD("minecraft:area_effect_cloud", 6.0, 0.5, AreaEffectCloudMeta::new),
|
||||
AREA_EFFECT_CLOUD("minecraft:area_effect_cloud", 6.0, 0.5, AreaEffectCloudMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
ARMOR_STAND("minecraft:armor_stand", 0.5, 1.975, ArmorStandMeta::new),
|
||||
ARMOR_STAND("minecraft:armor_stand", 0.5, 1.975, ArmorStandMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
ARROW("minecraft:arrow", 0.5, 0.5, ArrowMeta::new),
|
||||
ARROW("minecraft:arrow", 0.5, 0.5, ArrowMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
BAT("minecraft:bat", 0.5, 0.9, BatMeta::new),
|
||||
BAT("minecraft:bat", 0.5, 0.9, BatMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
BEE("minecraft:bee", 0.7, 0.6, BeeMeta::new),
|
||||
BEE("minecraft:bee", 0.7, 0.6, BeeMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
BLAZE("minecraft:blaze", 0.6, 1.8, BlazeMeta::new),
|
||||
BLAZE("minecraft:blaze", 0.6, 1.8, BlazeMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
BOAT("minecraft:boat", 1.375, 0.5625, BoatMeta::new),
|
||||
BOAT("minecraft:boat", 1.375, 0.5625, BoatMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
CAT("minecraft:cat", 0.6, 0.7, CatMeta::new),
|
||||
CAT("minecraft:cat", 0.6, 0.7, CatMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
CAVE_SPIDER("minecraft:cave_spider", 0.7, 0.5, CaveSpiderMeta::new),
|
||||
CAVE_SPIDER("minecraft:cave_spider", 0.7, 0.5, CaveSpiderMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
CHICKEN("minecraft:chicken", 0.4, 0.7, ChickenMeta::new),
|
||||
CHICKEN("minecraft:chicken", 0.4, 0.7, ChickenMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
COD("minecraft:cod", 0.5, 0.3, CodMeta::new),
|
||||
COD("minecraft:cod", 0.5, 0.3, CodMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
COW("minecraft:cow", 0.9, 1.4, CowMeta::new),
|
||||
COW("minecraft:cow", 0.9, 1.4, CowMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
CREEPER("minecraft:creeper", 0.6, 1.7, CreeperMeta::new),
|
||||
CREEPER("minecraft:creeper", 0.6, 1.7, CreeperMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
DOLPHIN("minecraft:dolphin", 0.9, 0.6, DolphinMeta::new),
|
||||
DOLPHIN("minecraft:dolphin", 0.9, 0.6, DolphinMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
DONKEY("minecraft:donkey", 1.39648, 1.5, DonkeyMeta::new),
|
||||
DONKEY("minecraft:donkey", 1.39648, 1.5, DonkeyMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
DRAGON_FIREBALL("minecraft:dragon_fireball", 1.0, 1.0, DragonFireballMeta::new),
|
||||
DRAGON_FIREBALL("minecraft:dragon_fireball", 1.0, 1.0, DragonFireballMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
DROWNED("minecraft:drowned", 0.6, 1.95, DrownedMeta::new),
|
||||
DROWNED("minecraft:drowned", 0.6, 1.95, DrownedMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
ELDER_GUARDIAN("minecraft:elder_guardian", 1.9975, 1.9975, ElderGuardianMeta::new),
|
||||
ELDER_GUARDIAN("minecraft:elder_guardian", 1.9975, 1.9975, ElderGuardianMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
END_CRYSTAL("minecraft:end_crystal", 2.0, 2.0, EndCrystalMeta::new),
|
||||
END_CRYSTAL("minecraft:end_crystal", 2.0, 2.0, EndCrystalMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
ENDER_DRAGON("minecraft:ender_dragon", 16.0, 8.0, EnderDragonMeta::new),
|
||||
ENDER_DRAGON("minecraft:ender_dragon", 16.0, 8.0, EnderDragonMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
ENDERMAN("minecraft:enderman", 0.6, 2.9, EndermanMeta::new),
|
||||
ENDERMAN("minecraft:enderman", 0.6, 2.9, EndermanMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
ENDERMITE("minecraft:endermite", 0.4, 0.3, EndermiteMeta::new),
|
||||
ENDERMITE("minecraft:endermite", 0.4, 0.3, EndermiteMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
EVOKER("minecraft:evoker", 0.6, 1.95, EvokerMeta::new),
|
||||
EVOKER("minecraft:evoker", 0.6, 1.95, EvokerMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
EVOKER_FANGS("minecraft:evoker_fangs", 0.5, 0.8, EvokerFangsMeta::new),
|
||||
EVOKER_FANGS("minecraft:evoker_fangs", 0.5, 0.8, EvokerFangsMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
EXPERIENCE_ORB("minecraft:experience_orb", 0.5, 0.5, ExperienceOrbMeta::new),
|
||||
EXPERIENCE_ORB("minecraft:experience_orb", 0.5, 0.5, ExperienceOrbMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
EYE_OF_ENDER("minecraft:eye_of_ender", 0.25, 0.25, EyeOfEnderMeta::new),
|
||||
EYE_OF_ENDER("minecraft:eye_of_ender", 0.25, 0.25, EyeOfEnderMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
FALLING_BLOCK("minecraft:falling_block", 0.98, 0.98, FallingBlockMeta::new),
|
||||
FALLING_BLOCK("minecraft:falling_block", 0.98, 0.98, FallingBlockMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
FIREWORK_ROCKET("minecraft:firework_rocket", 0.25, 0.25, FireworkRocketMeta::new),
|
||||
FIREWORK_ROCKET("minecraft:firework_rocket", 0.25, 0.25, FireworkRocketMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
FOX("minecraft:fox", 0.6, 0.7, FoxMeta::new),
|
||||
FOX("minecraft:fox", 0.6, 0.7, FoxMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
GHAST("minecraft:ghast", 4.0, 4.0, GhastMeta::new),
|
||||
GHAST("minecraft:ghast", 4.0, 4.0, GhastMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
GIANT("minecraft:giant", 3.6, 12.0, GiantMeta::new),
|
||||
GIANT("minecraft:giant", 3.6, 12.0, GiantMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
GUARDIAN("minecraft:guardian", 0.85, 0.85, GuardianMeta::new),
|
||||
GUARDIAN("minecraft:guardian", 0.85, 0.85, GuardianMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
HOGLIN("minecraft:hoglin", 1.39648, 1.4, HoglinMeta::new),
|
||||
HOGLIN("minecraft:hoglin", 1.39648, 1.4, HoglinMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
HORSE("minecraft:horse", 1.39648, 1.6, HorseMeta::new),
|
||||
HORSE("minecraft:horse", 1.39648, 1.6, HorseMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
HUSK("minecraft:husk", 0.6, 1.95, HuskMeta::new),
|
||||
HUSK("minecraft:husk", 0.6, 1.95, HuskMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
ILLUSIONER("minecraft:illusioner", 0.6, 1.95, IllusionerMeta::new),
|
||||
ILLUSIONER("minecraft:illusioner", 0.6, 1.95, IllusionerMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
IRON_GOLEM("minecraft:iron_golem", 1.4, 2.7, IronGolemMeta::new),
|
||||
IRON_GOLEM("minecraft:iron_golem", 1.4, 2.7, IronGolemMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
ITEM("minecraft:item", 0.25, 0.25, ItemEntityMeta::new),
|
||||
ITEM("minecraft:item", 0.25, 0.25, ItemEntityMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
ITEM_FRAME("minecraft:item_frame", 0.5, 0.5, ItemFrameMeta::new),
|
||||
ITEM_FRAME("minecraft:item_frame", 0.5, 0.5, ItemFrameMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
FIREBALL("minecraft:fireball", 1.0, 1.0, FireballMeta::new),
|
||||
FIREBALL("minecraft:fireball", 1.0, 1.0, FireballMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
LEASH_KNOT("minecraft:leash_knot", 0.5, 0.5, LeashKnotMeta::new),
|
||||
LEASH_KNOT("minecraft:leash_knot", 0.5, 0.5, LeashKnotMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
LIGHTNING_BOLT("minecraft:lightning_bolt", 0.0, 0.0, LightningBoltMeta::new),
|
||||
LIGHTNING_BOLT("minecraft:lightning_bolt", 0.0, 0.0, LightningBoltMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
LLAMA("minecraft:llama", 0.9, 1.87, LlamaMeta::new),
|
||||
LLAMA("minecraft:llama", 0.9, 1.87, LlamaMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
LLAMA_SPIT("minecraft:llama_spit", 0.25, 0.25, LlamaSpitMeta::new),
|
||||
LLAMA_SPIT("minecraft:llama_spit", 0.25, 0.25, LlamaSpitMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
MAGMA_CUBE("minecraft:magma_cube", 2.04, 2.04, MagmaCubeMeta::new),
|
||||
MAGMA_CUBE("minecraft:magma_cube", 2.04, 2.04, MagmaCubeMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
MINECART("minecraft:minecart", 0.98, 0.7, MinecartMeta::new),
|
||||
MINECART("minecraft:minecart", 0.98, 0.7, MinecartMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
CHEST_MINECART("minecraft:chest_minecart", 0.98, 0.7, ChestMinecartMeta::new),
|
||||
CHEST_MINECART("minecraft:chest_minecart", 0.98, 0.7, ChestMinecartMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
COMMAND_BLOCK_MINECART("minecraft:command_block_minecart", 0.98, 0.7, CommandBlockMinecartMeta::new),
|
||||
COMMAND_BLOCK_MINECART("minecraft:command_block_minecart", 0.98, 0.7, CommandBlockMinecartMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
FURNACE_MINECART("minecraft:furnace_minecart", 0.98, 0.7, FurnaceMinecartMeta::new),
|
||||
FURNACE_MINECART("minecraft:furnace_minecart", 0.98, 0.7, FurnaceMinecartMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
HOPPER_MINECART("minecraft:hopper_minecart", 0.98, 0.7, HopperMinecartMeta::new),
|
||||
HOPPER_MINECART("minecraft:hopper_minecart", 0.98, 0.7, HopperMinecartMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
SPAWNER_MINECART("minecraft:spawner_minecart", 0.98, 0.7, SpawnerMinecartMeta::new),
|
||||
SPAWNER_MINECART("minecraft:spawner_minecart", 0.98, 0.7, SpawnerMinecartMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
TNT_MINECART("minecraft:tnt_minecart", 0.98, 0.7, TntMinecartMeta::new),
|
||||
TNT_MINECART("minecraft:tnt_minecart", 0.98, 0.7, TntMinecartMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
MULE("minecraft:mule", 1.39648, 1.6, MuleMeta::new),
|
||||
MULE("minecraft:mule", 1.39648, 1.6, MuleMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
MOOSHROOM("minecraft:mooshroom", 0.9, 1.4, MooshroomMeta::new),
|
||||
MOOSHROOM("minecraft:mooshroom", 0.9, 1.4, MooshroomMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
OCELOT("minecraft:ocelot", 0.6, 0.7, OcelotMeta::new),
|
||||
OCELOT("minecraft:ocelot", 0.6, 0.7, OcelotMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
PAINTING("minecraft:painting", 0.5, 0.5, PaintingMeta::new),
|
||||
PAINTING("minecraft:painting", 0.5, 0.5, PaintingMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
PANDA("minecraft:panda", 1.3, 1.25, PandaMeta::new),
|
||||
PANDA("minecraft:panda", 1.3, 1.25, PandaMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
PARROT("minecraft:parrot", 0.5, 0.9, ParrotMeta::new),
|
||||
PARROT("minecraft:parrot", 0.5, 0.9, ParrotMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
PHANTOM("minecraft:phantom", 0.9, 0.5, PhantomMeta::new),
|
||||
PHANTOM("minecraft:phantom", 0.9, 0.5, PhantomMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
PIG("minecraft:pig", 0.9, 0.9, PigMeta::new),
|
||||
PIG("minecraft:pig", 0.9, 0.9, PigMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
PIGLIN("minecraft:piglin", 0.6, 1.95, PiglinMeta::new),
|
||||
PIGLIN("minecraft:piglin", 0.6, 1.95, PiglinMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
PIGLIN_BRUTE("minecraft:piglin_brute", 0.6, 1.95, PiglinBruteMeta::new),
|
||||
PIGLIN_BRUTE("minecraft:piglin_brute", 0.6, 1.95, PiglinBruteMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
PILLAGER("minecraft:pillager", 0.6, 1.95, PillagerMeta::new),
|
||||
PILLAGER("minecraft:pillager", 0.6, 1.95, PillagerMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
POLAR_BEAR("minecraft:polar_bear", 1.4, 1.4, PolarBearMeta::new),
|
||||
POLAR_BEAR("minecraft:polar_bear", 1.4, 1.4, PolarBearMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
TNT("minecraft:tnt", 0.98, 0.98, PrimedTntMeta::new),
|
||||
TNT("minecraft:tnt", 0.98, 0.98, PrimedTntMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
PUFFERFISH("minecraft:pufferfish", 0.7, 0.7, PufferfishMeta::new),
|
||||
PUFFERFISH("minecraft:pufferfish", 0.7, 0.7, PufferfishMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
RABBIT("minecraft:rabbit", 0.4, 0.5, RabbitMeta::new),
|
||||
RABBIT("minecraft:rabbit", 0.4, 0.5, RabbitMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
RAVAGER("minecraft:ravager", 1.95, 2.2, RavagerMeta::new),
|
||||
RAVAGER("minecraft:ravager", 1.95, 2.2, RavagerMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
SALMON("minecraft:salmon", 0.7, 0.4, SalmonMeta::new),
|
||||
SALMON("minecraft:salmon", 0.7, 0.4, SalmonMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
SHEEP("minecraft:sheep", 0.9, 1.3, SheepMeta::new),
|
||||
SHEEP("minecraft:sheep", 0.9, 1.3, SheepMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
SHULKER("minecraft:shulker", 1.0, 1.0, ShulkerMeta::new),
|
||||
SHULKER("minecraft:shulker", 1.0, 1.0, ShulkerMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
SHULKER_BULLET("minecraft:shulker_bullet", 0.3125, 0.3125, ShulkerBulletMeta::new),
|
||||
SHULKER_BULLET("minecraft:shulker_bullet", 0.3125, 0.3125, ShulkerBulletMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
SILVERFISH("minecraft:silverfish", 0.4, 0.3, SilverfishMeta::new),
|
||||
SILVERFISH("minecraft:silverfish", 0.4, 0.3, SilverfishMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
SKELETON("minecraft:skeleton", 0.6, 1.99, SkeletonMeta::new),
|
||||
SKELETON("minecraft:skeleton", 0.6, 1.99, SkeletonMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
SKELETON_HORSE("minecraft:skeleton_horse", 1.39648, 1.6, SkeletonHorseMeta::new),
|
||||
SKELETON_HORSE("minecraft:skeleton_horse", 1.39648, 1.6, SkeletonHorseMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
SLIME("minecraft:slime", 2.04, 2.04, SlimeMeta::new),
|
||||
SLIME("minecraft:slime", 2.04, 2.04, SlimeMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
SMALL_FIREBALL("minecraft:small_fireball", 0.3125, 0.3125, SmallFireballMeta::new),
|
||||
SMALL_FIREBALL("minecraft:small_fireball", 0.3125, 0.3125, SmallFireballMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
SNOW_GOLEM("minecraft:snow_golem", 0.7, 1.9, SnowGolemMeta::new),
|
||||
SNOW_GOLEM("minecraft:snow_golem", 0.7, 1.9, SnowGolemMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
SNOWBALL("minecraft:snowball", 0.25, 0.25, SnowballMeta::new),
|
||||
SNOWBALL("minecraft:snowball", 0.25, 0.25, SnowballMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
SPECTRAL_ARROW("minecraft:spectral_arrow", 0.5, 0.5, SpectralArrowMeta::new),
|
||||
SPECTRAL_ARROW("minecraft:spectral_arrow", 0.5, 0.5, SpectralArrowMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
SPIDER("minecraft:spider", 1.4, 0.9, SpiderMeta::new),
|
||||
SPIDER("minecraft:spider", 1.4, 0.9, SpiderMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
SQUID("minecraft:squid", 0.8, 0.8, SquidMeta::new),
|
||||
SQUID("minecraft:squid", 0.8, 0.8, SquidMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
STRAY("minecraft:stray", 0.6, 1.99, StrayMeta::new),
|
||||
STRAY("minecraft:stray", 0.6, 1.99, StrayMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
STRIDER("minecraft:strider", 0.9, 1.7, StriderMeta::new),
|
||||
STRIDER("minecraft:strider", 0.9, 1.7, StriderMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
EGG("minecraft:egg", 0.25, 0.25, ThrownEggMeta::new),
|
||||
EGG("minecraft:egg", 0.25, 0.25, ThrownEggMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
ENDER_PEARL("minecraft:ender_pearl", 0.25, 0.25, ThrownEnderPearlMeta::new),
|
||||
ENDER_PEARL("minecraft:ender_pearl", 0.25, 0.25, ThrownEnderPearlMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
EXPERIENCE_BOTTLE("minecraft:experience_bottle", 0.25, 0.25, ThrownExperienceBottleMeta::new),
|
||||
EXPERIENCE_BOTTLE("minecraft:experience_bottle", 0.25, 0.25, ThrownExperienceBottleMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
POTION("minecraft:potion", 0.25, 0.25, ThrownPotionMeta::new),
|
||||
POTION("minecraft:potion", 0.25, 0.25, ThrownPotionMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
TRIDENT("minecraft:trident", 0.5, 0.5, ThrownTridentMeta::new),
|
||||
TRIDENT("minecraft:trident", 0.5, 0.5, ThrownTridentMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
TRADER_LLAMA("minecraft:trader_llama", 0.9, 1.87, TraderLlamaMeta::new),
|
||||
TRADER_LLAMA("minecraft:trader_llama", 0.9, 1.87, TraderLlamaMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
TROPICAL_FISH("minecraft:tropical_fish", 0.5, 0.4, TropicalFishMeta::new),
|
||||
TROPICAL_FISH("minecraft:tropical_fish", 0.5, 0.4, TropicalFishMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
TURTLE("minecraft:turtle", 1.2, 0.4, TurtleMeta::new),
|
||||
TURTLE("minecraft:turtle", 1.2, 0.4, TurtleMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
VEX("minecraft:vex", 0.4, 0.8, VexMeta::new),
|
||||
VEX("minecraft:vex", 0.4, 0.8, VexMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
VILLAGER("minecraft:villager", 0.6, 1.95, VillagerMeta::new),
|
||||
VILLAGER("minecraft:villager", 0.6, 1.95, VillagerMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
VINDICATOR("minecraft:vindicator", 0.6, 1.95, VindicatorMeta::new),
|
||||
VINDICATOR("minecraft:vindicator", 0.6, 1.95, VindicatorMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
WANDERING_TRADER("minecraft:wandering_trader", 0.6, 1.95, WanderingTraderMeta::new),
|
||||
WANDERING_TRADER("minecraft:wandering_trader", 0.6, 1.95, WanderingTraderMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
WITCH("minecraft:witch", 0.6, 1.95, WitchMeta::new),
|
||||
WITCH("minecraft:witch", 0.6, 1.95, WitchMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
WITHER("minecraft:wither", 0.9, 3.5, WitherMeta::new),
|
||||
WITHER("minecraft:wither", 0.9, 3.5, WitherMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
WITHER_SKELETON("minecraft:wither_skeleton", 0.7, 2.4, WitherSkeletonMeta::new),
|
||||
WITHER_SKELETON("minecraft:wither_skeleton", 0.7, 2.4, WitherSkeletonMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
WITHER_SKULL("minecraft:wither_skull", 0.3125, 0.3125, WitherSkullMeta::new),
|
||||
WITHER_SKULL("minecraft:wither_skull", 0.3125, 0.3125, WitherSkullMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
WOLF("minecraft:wolf", 0.6, 0.85, WolfMeta::new),
|
||||
WOLF("minecraft:wolf", 0.6, 0.85, WolfMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
ZOGLIN("minecraft:zoglin", 1.39648, 1.4, ZoglinMeta::new),
|
||||
ZOGLIN("minecraft:zoglin", 1.39648, 1.4, ZoglinMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
ZOMBIE("minecraft:zombie", 0.6, 1.95, ZombieMeta::new),
|
||||
ZOMBIE("minecraft:zombie", 0.6, 1.95, ZombieMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
ZOMBIE_HORSE("minecraft:zombie_horse", 1.39648, 1.6, ZombieHorseMeta::new),
|
||||
ZOMBIE_HORSE("minecraft:zombie_horse", 1.39648, 1.6, ZombieHorseMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
ZOMBIE_VILLAGER("minecraft:zombie_villager", 0.6, 1.95, ZombieVillagerMeta::new),
|
||||
ZOMBIE_VILLAGER("minecraft:zombie_villager", 0.6, 1.95, ZombieVillagerMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
ZOMBIFIED_PIGLIN("minecraft:zombified_piglin", 0.6, 1.95, ZombifiedPiglinMeta::new),
|
||||
ZOMBIFIED_PIGLIN("minecraft:zombified_piglin", 0.6, 1.95, ZombifiedPiglinMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
PLAYER("minecraft:player", 0.6, 1.8, PlayerMeta::new),
|
||||
PLAYER("minecraft:player", 0.6, 1.8, PlayerMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
FISHING_BOBBER("minecraft:fishing_bobber", 0.25, 0.25, FishingHookMeta::new);
|
||||
FISHING_BOBBER("minecraft:fishing_bobber", 0.25, 0.25, FishingHookMeta::new, EntitySpawnType.BASE);
|
||||
|
||||
private static final EntityType[] VALUES = values();
|
||||
|
||||
@ -349,21 +349,26 @@ public enum EntityType {
|
||||
@NotNull
|
||||
private BiFunction<Entity, Metadata, EntityMeta> metaConstructor;
|
||||
|
||||
EntityType(@NotNull String namespaceID, double width, double height,
|
||||
@NotNull BiFunction<Entity, Metadata, EntityMeta> metaConstructor) {
|
||||
@NotNull
|
||||
private EntitySpawnType spawnType;
|
||||
|
||||
EntityType(@NotNull final String namespaceID, final double width, final double height,
|
||||
@NotNull final BiFunction<Entity, Metadata, EntityMeta> metaConstructor,
|
||||
@NotNull final EntitySpawnType spawnType) {
|
||||
this.namespaceID = namespaceID;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.metaConstructor = metaConstructor;
|
||||
this.spawnType = spawnType;
|
||||
Registries.entityTypes.put(NamespaceID.from(namespaceID), this);
|
||||
}
|
||||
|
||||
public short getId() {
|
||||
return (short)ordinal();
|
||||
return (short) ordinal();
|
||||
}
|
||||
|
||||
public String getNamespaceID() {
|
||||
return namespaceID;
|
||||
return this.namespaceID;
|
||||
}
|
||||
|
||||
public double getWidth() {
|
||||
@ -378,6 +383,10 @@ public enum EntityType {
|
||||
return this.metaConstructor;
|
||||
}
|
||||
|
||||
public EntitySpawnType getSpawnType() {
|
||||
return this.spawnType;
|
||||
}
|
||||
|
||||
public static EntityType fromId(short id) {
|
||||
if(id >= 0 && id < VALUES.length) {
|
||||
return VALUES[id];
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.minestom.codegen.entitytypes;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
import net.minestom.server.entity.EntitySpawnType;
|
||||
import net.minestom.server.utils.NamespaceID;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -18,6 +19,7 @@ public class EntityTypeContainer implements Comparable<EntityTypeContainer> {
|
||||
private double width;
|
||||
private double height;
|
||||
private Class<?> metaClass;
|
||||
private EntitySpawnType spawnType = EntitySpawnType.BASE;
|
||||
|
||||
public EntityTypeContainer(int id, NamespaceID name, double width, double height) {
|
||||
this.id = id;
|
||||
@ -70,6 +72,10 @@ public class EntityTypeContainer implements Comparable<EntityTypeContainer> {
|
||||
return metaClass;
|
||||
}
|
||||
|
||||
public EntitySpawnType getSpawnType() {
|
||||
return spawnType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(@NotNull EntityTypeContainer o) {
|
||||
return Integer.compare(id, o.id);
|
||||
|
@ -8,6 +8,7 @@ import net.minestom.codegen.ConstructorLambda;
|
||||
import net.minestom.codegen.EnumGenerator;
|
||||
import net.minestom.codegen.MinestomEnumGenerator;
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.EntitySpawnType;
|
||||
import net.minestom.server.entity.EntityType;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.entity.metadata.EntityMeta;
|
||||
@ -136,17 +137,18 @@ public class EntityTypeEnumGenerator extends MinestomEnumGenerator<EntityTypeCon
|
||||
Entity.class,
|
||||
Metadata.class,
|
||||
EntityMeta.class
|
||||
), "metaConstructor").addAnnotation(NotNull.class).build()
|
||||
), "metaConstructor").addAnnotation(NotNull.class).build(),
|
||||
ParameterSpec.builder(EntitySpawnType.class, "spawnType").addAnnotation(NotNull.class).build()
|
||||
);
|
||||
generator.appendToConstructor(code -> {
|
||||
code.addStatement("$T.$N.put($T.from(namespaceID), this)", Registries.class, "entityTypes", NamespaceID.class);
|
||||
});
|
||||
|
||||
generator.addMethod("getId", new ParameterSpec[0], TypeName.SHORT, code -> {
|
||||
code.addStatement("return (short)ordinal()");
|
||||
code.addStatement("return (short) ordinal()");
|
||||
});
|
||||
generator.addMethod("getNamespaceID", new ParameterSpec[0], ClassName.get(String.class), code -> {
|
||||
code.addStatement("return namespaceID");
|
||||
code.addStatement("return this.namespaceID");
|
||||
});
|
||||
generator.addMethod("getWidth", new ParameterSpec[0], TypeName.DOUBLE, code -> {
|
||||
code.addStatement("return this.width");
|
||||
@ -163,6 +165,9 @@ public class EntityTypeEnumGenerator extends MinestomEnumGenerator<EntityTypeCon
|
||||
),
|
||||
code -> code.addStatement("return this.metaConstructor")
|
||||
);
|
||||
generator.addMethod("getSpawnType", new ParameterSpec[0], ClassName.get(EntitySpawnType.class), code -> {
|
||||
code.addStatement("return this.spawnType");
|
||||
});
|
||||
|
||||
generator.addStaticField(ArrayTypeName.of(ClassName.get(EntityType.class)), "VALUES", "values()");
|
||||
|
||||
@ -181,7 +186,8 @@ public class EntityTypeEnumGenerator extends MinestomEnumGenerator<EntityTypeCon
|
||||
"\"" + type.getName().toString() + "\"",
|
||||
type.getWidth(),
|
||||
type.getHeight(),
|
||||
new ConstructorLambda(ClassName.get(type.getMetaClass()))
|
||||
new ConstructorLambda(ClassName.get(type.getMetaClass())),
|
||||
"EntitySpawnType." + type.getSpawnType().name()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,7 @@ import net.minestom.server.utils.validate.Check;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.time.Year;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
@ -1376,14 +1377,19 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer, P
|
||||
return scheduledRemoveTime != 0;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected Vector getVelocityForPacket() {
|
||||
return this.velocity.clone().multiply(8000f / MinecraftServer.TICK_PER_SECOND);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected EntityVelocityPacket getVelocityPacket() {
|
||||
final float strength = 8000f / MinecraftServer.TICK_PER_SECOND;
|
||||
EntityVelocityPacket velocityPacket = new EntityVelocityPacket();
|
||||
velocityPacket.entityId = getEntityId();
|
||||
velocityPacket.velocityX = (short) (velocity.getX() * strength);
|
||||
velocityPacket.velocityY = (short) (velocity.getY() * strength);
|
||||
velocityPacket.velocityZ = (short) (velocity.getZ() * strength);
|
||||
Vector velocity = getVelocityForPacket();
|
||||
velocityPacket.velocityX = (short) velocity.getX();
|
||||
velocityPacket.velocityY = (short) velocity.getY();
|
||||
velocityPacket.velocityZ = (short) velocity.getZ();
|
||||
return velocityPacket;
|
||||
}
|
||||
|
||||
|
109
src/main/java/net/minestom/server/entity/EntitySpawnType.java
Normal file
109
src/main/java/net/minestom/server/entity/EntitySpawnType.java
Normal file
@ -0,0 +1,109 @@
|
||||
package net.minestom.server.entity;
|
||||
|
||||
import net.minestom.server.entity.metadata.ObjectDataProvider;
|
||||
import net.minestom.server.entity.metadata.other.ExperienceOrbMeta;
|
||||
import net.minestom.server.entity.metadata.other.PaintingMeta;
|
||||
import net.minestom.server.network.packet.server.ServerPacket;
|
||||
import net.minestom.server.network.packet.server.play.*;
|
||||
import net.minestom.server.utils.BlockPosition;
|
||||
import net.minestom.server.utils.Vector;
|
||||
|
||||
public enum EntitySpawnType {
|
||||
BASE {
|
||||
@Override
|
||||
public ServerPacket getSpawnPacket(Entity entity) {
|
||||
SpawnEntityPacket packet = new SpawnEntityPacket();
|
||||
packet.entityId = entity.getEntityId();
|
||||
packet.uuid = entity.getUuid();
|
||||
packet.type = entity.getEntityType().ordinal();
|
||||
packet.position = entity.getPosition();
|
||||
if (entity.getEntityMeta() instanceof ObjectDataProvider) {
|
||||
ObjectDataProvider objectDataProvider = (ObjectDataProvider) entity.getEntityMeta();
|
||||
packet.data = objectDataProvider.getObjectData();
|
||||
if (objectDataProvider.requiresVelocityPacketAtSpawn()) {
|
||||
Vector velocity = entity.getVelocityForPacket();
|
||||
packet.velocityX = (short) velocity.getX();
|
||||
packet.velocityY = (short) velocity.getY();
|
||||
packet.velocityZ = (short) velocity.getZ();
|
||||
}
|
||||
}
|
||||
return packet;
|
||||
}
|
||||
},
|
||||
LIVING {
|
||||
@Override
|
||||
public ServerPacket getSpawnPacket(Entity entity) {
|
||||
SpawnLivingEntityPacket packet = new SpawnLivingEntityPacket();
|
||||
packet.entityId = entity.getEntityId();
|
||||
packet.entityUuid = entity.getUuid();
|
||||
packet.entityType = entity.getEntityType().ordinal();
|
||||
packet.position = entity.getPosition();
|
||||
packet.headPitch = entity.getPosition().getPitch();
|
||||
Vector velocity = entity.getVelocityForPacket();
|
||||
packet.velocityX = (short) velocity.getX();
|
||||
packet.velocityY = (short) velocity.getY();
|
||||
packet.velocityZ = (short) velocity.getZ();
|
||||
return packet;
|
||||
}
|
||||
},
|
||||
PLAYER {
|
||||
@Override
|
||||
public ServerPacket getSpawnPacket(Entity entity) {
|
||||
SpawnPlayerPacket packet = new SpawnPlayerPacket();
|
||||
packet.entityId = entity.getEntityId();
|
||||
packet.playerUuid = entity.getUuid();
|
||||
packet.position = entity.getPosition();
|
||||
return packet;
|
||||
}
|
||||
},
|
||||
EXPERIENCE_ORB {
|
||||
@Override
|
||||
public ServerPacket getSpawnPacket(Entity entity) {
|
||||
SpawnExperienceOrbPacket packet = new SpawnExperienceOrbPacket();
|
||||
packet.entityId = entity.getEntityId();
|
||||
packet.position = entity.getPosition();
|
||||
if (entity.getEntityMeta() instanceof ExperienceOrbMeta) {
|
||||
ExperienceOrbMeta experienceOrbMeta = (ExperienceOrbMeta) entity.getEntityMeta();
|
||||
packet.expCount = (short) experienceOrbMeta.getCount();
|
||||
}
|
||||
return packet;
|
||||
}
|
||||
},
|
||||
PAINTING {
|
||||
@Override
|
||||
public ServerPacket getSpawnPacket(Entity entity) {
|
||||
SpawnPaintingPacket packet = new SpawnPaintingPacket();
|
||||
packet.entityId = entity.getEntityId();
|
||||
packet.entityUuid = entity.getUuid();
|
||||
if (entity.getEntityMeta() instanceof PaintingMeta) {
|
||||
PaintingMeta paintingMeta = (PaintingMeta) entity.getEntityMeta();
|
||||
packet.motive = paintingMeta.getMotive().ordinal();
|
||||
packet.position = new BlockPosition(
|
||||
Math.max(0, (paintingMeta.getMotive().getWidth() >> 1) - 1),
|
||||
paintingMeta.getMotive().getHeight() >> 1,
|
||||
0
|
||||
);
|
||||
switch (paintingMeta.getDirection()) {
|
||||
case SOUTH:
|
||||
packet.direction = 0;
|
||||
break;
|
||||
case WEST:
|
||||
packet.direction = 1;
|
||||
break;
|
||||
case NORTH:
|
||||
packet.direction = 2;
|
||||
break;
|
||||
default:
|
||||
packet.direction = 3;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
packet.position = new BlockPosition(0, 0, 0);
|
||||
}
|
||||
return packet;
|
||||
}
|
||||
};
|
||||
|
||||
public abstract ServerPacket getSpawnPacket(Entity entity);
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package net.minestom.server.entity.metadata;
|
||||
|
||||
// https://wiki.vg/Object_Data
|
||||
public interface ObjectDataProvider {
|
||||
|
||||
int getObjectData();
|
||||
|
||||
boolean requiresVelocityPacketAtSpawn();
|
||||
|
||||
}
|
@ -3,9 +3,13 @@ package net.minestom.server.entity.metadata.arrow;
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.entity.metadata.EntityMeta;
|
||||
import net.minestom.server.entity.metadata.ObjectDataProvider;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class ArrowMeta extends EntityMeta {
|
||||
public class ArrowMeta extends EntityMeta implements ObjectDataProvider {
|
||||
|
||||
private Entity shooter;
|
||||
|
||||
public ArrowMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata);
|
||||
@ -19,4 +23,23 @@ public class ArrowMeta extends EntityMeta {
|
||||
super.metadata.setIndex((byte) 9, Metadata.VarInt(value));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Entity getShooter() {
|
||||
return this.shooter;
|
||||
}
|
||||
|
||||
public void setShooter(@Nullable Entity shooter) {
|
||||
this.shooter = shooter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
return this.shooter == null ? 0 : this.shooter.getEntityId() + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresVelocityPacketAtSpawn() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,12 +2,35 @@ package net.minestom.server.entity.metadata.arrow;
|
||||
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.entity.metadata.ObjectDataProvider;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class SpectralArrowMeta extends AbstractArrowMeta {
|
||||
public class SpectralArrowMeta extends AbstractArrowMeta implements ObjectDataProvider {
|
||||
|
||||
private Entity shooter;
|
||||
|
||||
public SpectralArrowMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Entity getShooter() {
|
||||
return this.shooter;
|
||||
}
|
||||
|
||||
public void setShooter(@Nullable Entity shooter) {
|
||||
this.shooter = shooter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
return this.shooter == null ? 0 : this.shooter.getEntityId() + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresVelocityPacketAtSpawn() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
package net.minestom.server.entity.metadata.object;
|
||||
package net.minestom.server.entity.metadata.item;
|
||||
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.item.Material;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class EyeOfEnderMeta extends ObjectEntityMeta {
|
||||
public class EyeOfEnderMeta extends ItemContainingMeta {
|
||||
|
||||
public EyeOfEnderMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata, Material.ENDER_EYE);
|
@ -0,0 +1,37 @@
|
||||
package net.minestom.server.entity.metadata.item;
|
||||
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.entity.metadata.ObjectDataProvider;
|
||||
import net.minestom.server.item.Material;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class FireballMeta extends ItemContainingMeta implements ObjectDataProvider {
|
||||
|
||||
private Entity shooter;
|
||||
|
||||
public FireballMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata, Material.AIR);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Entity getShooter() {
|
||||
return shooter;
|
||||
}
|
||||
|
||||
public void setShooter(@Nullable Entity shooter) {
|
||||
this.shooter = shooter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
return this.shooter == null ? 0 : this.shooter.getEntityId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresVelocityPacketAtSpawn() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package net.minestom.server.entity.metadata.object;
|
||||
package net.minestom.server.entity.metadata.item;
|
||||
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
@ -7,11 +7,11 @@ import net.minestom.server.item.ItemStack;
|
||||
import net.minestom.server.item.Material;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ObjectEntityMeta extends EntityMeta {
|
||||
class ItemContainingMeta extends EntityMeta {
|
||||
|
||||
private final ItemStack defaultItem;
|
||||
|
||||
protected ObjectEntityMeta(@NotNull Entity entity, @NotNull Metadata metadata, @NotNull Material defaultItemMaterial) {
|
||||
protected ItemContainingMeta(@NotNull Entity entity, @NotNull Metadata metadata, @NotNull Material defaultItemMaterial) {
|
||||
super(entity, metadata);
|
||||
this.defaultItem = new ItemStack(defaultItemMaterial, (byte) 1);
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package net.minestom.server.entity.metadata.item;
|
||||
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.entity.metadata.ObjectDataProvider;
|
||||
import net.minestom.server.item.Material;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ItemEntityMeta extends ItemContainingMeta implements ObjectDataProvider {
|
||||
|
||||
public ItemEntityMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata, Material.AIR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresVelocityPacketAtSpawn() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package net.minestom.server.entity.metadata.item;
|
||||
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.entity.metadata.ObjectDataProvider;
|
||||
import net.minestom.server.item.Material;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class SmallFireballMeta extends ItemContainingMeta implements ObjectDataProvider {
|
||||
|
||||
private Entity shooter;
|
||||
|
||||
public SmallFireballMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata, Material.FIRE_CHARGE);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Entity getShooter() {
|
||||
return shooter;
|
||||
}
|
||||
|
||||
public void setShooter(@Nullable Entity shooter) {
|
||||
this.shooter = shooter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
return this.shooter == null ? 0 : this.shooter.getEntityId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresVelocityPacketAtSpawn() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
package net.minestom.server.entity.metadata.object;
|
||||
package net.minestom.server.entity.metadata.item;
|
||||
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.item.Material;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class SnowballMeta extends ObjectEntityMeta {
|
||||
public class SnowballMeta extends ItemContainingMeta {
|
||||
|
||||
public SnowballMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata, Material.SNOWBALL);
|
@ -1,11 +1,11 @@
|
||||
package net.minestom.server.entity.metadata.object;
|
||||
package net.minestom.server.entity.metadata.item;
|
||||
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.item.Material;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ThrownEggMeta extends ObjectEntityMeta {
|
||||
public class ThrownEggMeta extends ItemContainingMeta {
|
||||
|
||||
public ThrownEggMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata, Material.EGG);
|
@ -1,11 +1,11 @@
|
||||
package net.minestom.server.entity.metadata.object;
|
||||
package net.minestom.server.entity.metadata.item;
|
||||
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.item.Material;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ThrownEnderPearlMeta extends ObjectEntityMeta {
|
||||
public class ThrownEnderPearlMeta extends ItemContainingMeta {
|
||||
|
||||
public ThrownEnderPearlMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata, Material.ENDER_PEARL);
|
@ -1,11 +1,11 @@
|
||||
package net.minestom.server.entity.metadata.object;
|
||||
package net.minestom.server.entity.metadata.item;
|
||||
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.item.Material;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ThrownExperienceBottleMeta extends ObjectEntityMeta {
|
||||
public class ThrownExperienceBottleMeta extends ItemContainingMeta {
|
||||
|
||||
public ThrownExperienceBottleMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata, Material.EXPERIENCE_BOTTLE);
|
@ -1,11 +1,11 @@
|
||||
package net.minestom.server.entity.metadata.object;
|
||||
package net.minestom.server.entity.metadata.item;
|
||||
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.item.Material;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ThrownPotionMeta extends ObjectEntityMeta {
|
||||
public class ThrownPotionMeta extends ItemContainingMeta {
|
||||
|
||||
public ThrownPotionMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata, Material.AIR);
|
@ -4,7 +4,7 @@ import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class AbstractMinecartContainerMeta extends AbstractMinecartMeta {
|
||||
public abstract class AbstractMinecartContainerMeta extends AbstractMinecartMeta {
|
||||
|
||||
protected AbstractMinecartContainerMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata);
|
||||
|
@ -3,9 +3,10 @@ package net.minestom.server.entity.metadata.minecart;
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.entity.metadata.EntityMeta;
|
||||
import net.minestom.server.entity.metadata.ObjectDataProvider;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class AbstractMinecartMeta extends EntityMeta {
|
||||
public abstract class AbstractMinecartMeta extends EntityMeta implements ObjectDataProvider {
|
||||
|
||||
protected AbstractMinecartMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata);
|
||||
@ -52,4 +53,9 @@ public class AbstractMinecartMeta extends EntityMeta {
|
||||
super.metadata.setIndex((byte) 11, Metadata.VarInt(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresVelocityPacketAtSpawn() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,4 +10,9 @@ public class ChestMinecartMeta extends AbstractMinecartContainerMeta {
|
||||
super(entity, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,4 +30,9 @@ public class CommandBlockMinecartMeta extends AbstractMinecartMeta {
|
||||
super.metadata.setIndex((byte) 14, Metadata.Chat(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
return 6;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,4 +18,9 @@ public class FurnaceMinecartMeta extends AbstractMinecartMeta {
|
||||
super.metadata.setIndex((byte) 13, Metadata.Boolean(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,4 +10,9 @@ public class HopperMinecartMeta extends AbstractMinecartContainerMeta {
|
||||
super(entity, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,4 +10,9 @@ public class MinecartMeta extends AbstractMinecartMeta {
|
||||
super(entity, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,4 +10,9 @@ public class SpawnerMinecartMeta extends AbstractMinecartMeta {
|
||||
super(entity, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,4 +10,9 @@ public class TntMinecartMeta extends AbstractMinecartMeta {
|
||||
super(entity, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,14 +0,0 @@
|
||||
package net.minestom.server.entity.metadata.object;
|
||||
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.item.Material;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class FireballMeta extends ObjectEntityMeta {
|
||||
|
||||
public FireballMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata, Material.AIR);
|
||||
}
|
||||
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package net.minestom.server.entity.metadata.object;
|
||||
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.item.Material;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ItemEntityMeta extends ObjectEntityMeta {
|
||||
|
||||
public ItemEntityMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata, Material.AIR);
|
||||
}
|
||||
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package net.minestom.server.entity.metadata.object;
|
||||
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.item.Material;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class SmallFireballMeta extends ObjectEntityMeta {
|
||||
|
||||
public SmallFireballMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata, Material.FIRE_CHARGE);
|
||||
}
|
||||
|
||||
}
|
@ -3,12 +3,35 @@ package net.minestom.server.entity.metadata.other;
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.entity.metadata.EntityMeta;
|
||||
import net.minestom.server.entity.metadata.ObjectDataProvider;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class DragonFireballMeta extends EntityMeta {
|
||||
public class DragonFireballMeta extends EntityMeta implements ObjectDataProvider {
|
||||
|
||||
private Entity shooter;
|
||||
|
||||
public DragonFireballMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Entity getShooter() {
|
||||
return shooter;
|
||||
}
|
||||
|
||||
public void setShooter(@Nullable Entity shooter) {
|
||||
this.shooter = shooter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
return this.shooter == null ? 0 : this.shooter.getEntityId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresVelocityPacketAtSpawn() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,8 +7,23 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ExperienceOrbMeta extends EntityMeta {
|
||||
|
||||
private int count = 1;
|
||||
|
||||
public ExperienceOrbMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata);
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets count of orbs.
|
||||
* This is possible only before spawn packet is sent.
|
||||
*
|
||||
* @param count count of orbs.
|
||||
*/
|
||||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
}
|
||||
|
@ -3,10 +3,14 @@ package net.minestom.server.entity.metadata.other;
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.entity.metadata.EntityMeta;
|
||||
import net.minestom.server.entity.metadata.ObjectDataProvider;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.utils.BlockPosition;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class FallingBlockMeta extends EntityMeta {
|
||||
public class FallingBlockMeta extends EntityMeta implements ObjectDataProvider {
|
||||
|
||||
private Block block = Block.STONE;
|
||||
|
||||
public FallingBlockMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata);
|
||||
@ -20,4 +24,32 @@ public class FallingBlockMeta extends EntityMeta {
|
||||
super.metadata.setIndex((byte) 7, Metadata.Position(value));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets which block to display.
|
||||
* This is possible only before spawn packet is sent.
|
||||
*
|
||||
* @param block which block to display.
|
||||
*/
|
||||
public void setBlock(@NotNull Block block) {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
int id = this.block.getBlockId();
|
||||
int metadata = 0; // TODO ?
|
||||
return id | (metadata << 12);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresVelocityPacketAtSpawn() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,14 +3,18 @@ package net.minestom.server.entity.metadata.other;
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.entity.metadata.EntityMeta;
|
||||
import net.minestom.server.entity.metadata.ObjectDataProvider;
|
||||
import net.minestom.server.item.ItemStack;
|
||||
import net.minestom.server.utils.Rotation;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ItemFrameMeta extends EntityMeta {
|
||||
public class ItemFrameMeta extends EntityMeta implements ObjectDataProvider {
|
||||
|
||||
private Orientation orientation;
|
||||
|
||||
public ItemFrameMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata);
|
||||
this.orientation = Orientation.DOWN;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@ -22,12 +26,47 @@ public class ItemFrameMeta extends EntityMeta {
|
||||
super.metadata.setIndex((byte) 7, Metadata.Slot(value));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Rotation getRotation() {
|
||||
return Rotation.values()[super.metadata.getIndex((byte) 8, 0)];
|
||||
}
|
||||
|
||||
public void setRotation(Rotation value) {
|
||||
public void setRotation(@NotNull Rotation value) {
|
||||
super.metadata.setIndex((byte) 8, Metadata.VarInt(value.ordinal()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Orientation getOrientation() {
|
||||
return this.orientation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets orientation of the item frame.
|
||||
* This is possible only before spawn packet is sent.
|
||||
*
|
||||
* @param orientation the orientation of the item frame.
|
||||
*/
|
||||
public void setOrientation(@NotNull Orientation orientation) {
|
||||
this.orientation = orientation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
return this.orientation.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresVelocityPacketAtSpawn() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public enum Orientation {
|
||||
DOWN,
|
||||
UP,
|
||||
NORTH,
|
||||
SOUTH,
|
||||
WEST,
|
||||
EAST
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,12 +3,23 @@ package net.minestom.server.entity.metadata.other;
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.entity.metadata.EntityMeta;
|
||||
import net.minestom.server.entity.metadata.ObjectDataProvider;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class LlamaSpitMeta extends EntityMeta {
|
||||
public class LlamaSpitMeta extends EntityMeta implements ObjectDataProvider {
|
||||
|
||||
public LlamaSpitMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresVelocityPacketAtSpawn() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,12 +3,126 @@ package net.minestom.server.entity.metadata.other;
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.entity.metadata.EntityMeta;
|
||||
import net.minestom.server.utils.Direction;
|
||||
import net.minestom.server.utils.validate.Check;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class PaintingMeta extends EntityMeta {
|
||||
|
||||
private Motive motive = Motive.KEBAB;
|
||||
private Direction direction = Direction.SOUTH;
|
||||
|
||||
public PaintingMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Motive getMotive() {
|
||||
return motive;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets motive of a painting.
|
||||
* This is possible only before spawn packet is sent.
|
||||
*
|
||||
* @param motive motive of a painting.
|
||||
*/
|
||||
public void setMotive(@NotNull Motive motive) {
|
||||
this.motive = motive;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Direction getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets direction of a painting.
|
||||
* This is possible only before spawn packet is sent.
|
||||
*
|
||||
* @param direction direction of a painting.
|
||||
*/
|
||||
public void setDirection(@NotNull Direction direction) {
|
||||
Check.argCondition(direction == Direction.UP || direction == Direction.DOWN, "Painting can't look up or down!");
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: write a parser?
|
||||
Currently none of existing ones support it.
|
||||
*/
|
||||
public enum Motive {
|
||||
KEBAB(0, 0, 16, 16),
|
||||
AZTEC(16, 0, 16, 16),
|
||||
ALBAN(32, 0, 16, 16),
|
||||
AZTEC2(48, 0, 16, 16),
|
||||
BOMB(64, 0, 16, 16),
|
||||
PLANT(80, 0, 16, 16),
|
||||
WASTELAND(96, 0, 16, 16),
|
||||
POOL(0, 32, 32, 16),
|
||||
COURBET(32, 32, 32, 16),
|
||||
SEA(64, 32, 32, 16),
|
||||
SUNSET(96, 32, 32, 16),
|
||||
CREEBET(128, 32, 32, 16),
|
||||
WANDERER(0, 64, 16, 32),
|
||||
GRAHAM(16, 64, 16, 32),
|
||||
MATCH(0, 128, 32, 32),
|
||||
BUST(32, 128, 32, 32),
|
||||
STAGE(64, 128, 32, 32),
|
||||
VOID(96, 128, 32, 32),
|
||||
SKULL_AND_ROSES("skull_and_roses", 128, 128, 32, 32),
|
||||
WITHER(160, 128, 32, 32),
|
||||
FIGHTERS(0, 96, 64, 32),
|
||||
POINTER(0, 192, 64, 64),
|
||||
PIGSCENE(64, 192, 64, 64),
|
||||
BURNING_SKULL(128, 192, 64, 64),
|
||||
SKELETON(192, 64, 64, 48),
|
||||
DONKEY_KONG(192, 112, 64, 48);
|
||||
|
||||
private final String name;
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int width;
|
||||
private final int height;
|
||||
|
||||
Motive(String name, int x, int y, int width, int height) {
|
||||
this.name = name;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
Motive(int x, int y, int width, int height) {
|
||||
this.name = "minecraft:" + name().toLowerCase(Locale.ROOT);
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return this.x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return this.y;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return this.width;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return this.height;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,12 +3,23 @@ package net.minestom.server.entity.metadata.other;
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.entity.metadata.EntityMeta;
|
||||
import net.minestom.server.entity.metadata.ObjectDataProvider;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ShulkerBulletMeta extends EntityMeta {
|
||||
public class ShulkerBulletMeta extends EntityMeta implements ObjectDataProvider {
|
||||
|
||||
public ShulkerBulletMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresVelocityPacketAtSpawn() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,9 +3,13 @@ package net.minestom.server.entity.metadata.other;
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.entity.metadata.EntityMeta;
|
||||
import net.minestom.server.entity.metadata.ObjectDataProvider;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class WitherSkullMeta extends EntityMeta {
|
||||
public class WitherSkullMeta extends EntityMeta implements ObjectDataProvider {
|
||||
|
||||
private Entity shooter;
|
||||
|
||||
public WitherSkullMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata);
|
||||
@ -19,4 +23,23 @@ public class WitherSkullMeta extends EntityMeta {
|
||||
super.metadata.setIndex((byte) 7, Metadata.Boolean(value));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Entity getShooter() {
|
||||
return shooter;
|
||||
}
|
||||
|
||||
public void setShooter(@Nullable Entity shooter) {
|
||||
this.shooter = shooter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
return this.shooter == null ? 0 : this.shooter.getEntityId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresVelocityPacketAtSpawn() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,9 +2,10 @@ package net.minestom.server.entity.metadata.water.fish;
|
||||
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.entity.metadata.ObjectDataProvider;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class TropicalFishMeta extends AbstractFishMeta {
|
||||
public class TropicalFishMeta extends AbstractFishMeta implements ObjectDataProvider {
|
||||
|
||||
public TropicalFishMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata);
|
||||
@ -41,6 +42,17 @@ public class TropicalFishMeta extends AbstractFishMeta {
|
||||
return new Variant(type, pattern, bodyColor, patternColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
// TODO: returns Entity ID of the owner (???)
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresVelocityPacketAtSpawn() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class Variant {
|
||||
|
||||
private Type type;
|
||||
|
@ -3,8 +3,6 @@ package net.minestom.server.entity.type.projectile;
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.EntityType;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.entity.ObjectEntity;
|
||||
import net.minestom.server.entity.type.Projectile;
|
||||
import net.minestom.server.item.ItemStack;
|
||||
import net.minestom.server.item.Material;
|
||||
import net.minestom.server.utils.Position;
|
||||
@ -12,7 +10,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link net.minestom.server.entity.metadata.object.EyeOfEnderMeta} instead.
|
||||
* @deprecated Use {@link net.minestom.server.entity.metadata.item.EyeOfEnderMeta} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public class EntityEyeOfEnder extends AbstractProjectile {
|
||||
|
@ -3,15 +3,13 @@ package net.minestom.server.entity.type.projectile;
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.EntityType;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.entity.ObjectEntity;
|
||||
import net.minestom.server.entity.type.Projectile;
|
||||
import net.minestom.server.item.ItemStack;
|
||||
import net.minestom.server.utils.Position;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link net.minestom.server.entity.metadata.object.ThrownPotionMeta} instead.
|
||||
* @deprecated Use {@link net.minestom.server.entity.metadata.item.ThrownPotionMeta} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public class EntityPotion extends AbstractProjectile {
|
||||
|
Loading…
Reference in New Issue
Block a user