Merge pull request #10 from OakLoaf/master
Alphabetically ordered entities and added some missing entities
This commit is contained in:
commit
a5a6c21f6a
4 changed files with 172 additions and 84 deletions
|
@ -1,8 +1,6 @@
|
|||
package me.tofaa.entitylib.meta;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.type.EntityType;
|
||||
import me.tofaa.entitylib.meta.EntityMeta;
|
||||
import me.tofaa.entitylib.meta.Metadata;
|
||||
import me.tofaa.entitylib.meta.display.BlockDisplayMeta;
|
||||
import me.tofaa.entitylib.meta.display.ItemDisplayMeta;
|
||||
import me.tofaa.entitylib.meta.display.TextDisplayMeta;
|
||||
|
@ -32,6 +30,7 @@ import me.tofaa.entitylib.meta.mobs.villager.VillagerMeta;
|
|||
import me.tofaa.entitylib.meta.mobs.villager.WanderingTraderMeta;
|
||||
import me.tofaa.entitylib.meta.other.*;
|
||||
import me.tofaa.entitylib.meta.projectile.*;
|
||||
import me.tofaa.entitylib.meta.types.LivingEntityMeta;
|
||||
import me.tofaa.entitylib.meta.types.PlayerMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
@ -41,121 +40,130 @@ import java.util.function.BiFunction;
|
|||
|
||||
import static com.github.retrooper.packetevents.protocol.entity.type.EntityTypes.*;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
final class MetaConverterRegistry {
|
||||
|
||||
private final Map<EntityType, BiFunction<Integer, Metadata, EntityMeta>> converters = new HashMap<>();
|
||||
private final Map<EntityType, Class<? extends EntityMeta>> metaClasses = new HashMap<>();
|
||||
|
||||
MetaConverterRegistry() {
|
||||
put(SNIFFER, SnifferMeta.class, SnifferMeta::new);
|
||||
put(INTERACTION, InteractionMeta.class, InteractionMeta::new);
|
||||
put(BLOCK_DISPLAY, BlockDisplayMeta.class, BlockDisplayMeta::new);
|
||||
put(ITEM_DISPLAY, ItemDisplayMeta.class, ItemDisplayMeta::new);
|
||||
put(TEXT_DISPLAY, TextDisplayMeta.class, TextDisplayMeta::new);
|
||||
put(ABSTRACT_WIND_CHARGE, SmallFireballMeta.class, SmallFireballMeta::new); // TODO: Verify correctness
|
||||
put(AREA_EFFECT_CLOUD, AreaEffectCloudMeta.class, AreaEffectCloudMeta::new);
|
||||
put(ARMADILLO, ArmadilloMeta.class, ArmadilloMeta::new); // TODO: Verify correctness
|
||||
put(ARMOR_STAND, ArmorStandMeta.class, ArmorStandMeta::new);
|
||||
put(ALLAY, LivingEntityMeta.class, LivingEntityMeta::new); // TODO: Implement
|
||||
put(ARROW, ArrowMeta.class, ArrowMeta::new);
|
||||
put(AXOLOTL, AxolotlMeta.class, AxolotlMeta::new);
|
||||
put(BAT, BatMeta.class, BatMeta::new);
|
||||
put(BEE, BeeMeta.class, BeeMeta::new);
|
||||
put(BLAZE, BlazeMeta.class, BlazeMeta::new);
|
||||
put(BLOCK_DISPLAY, BlockDisplayMeta.class, BlockDisplayMeta::new);
|
||||
put(BOAT, BoatMeta.class, BoatMeta::new);
|
||||
put(BOGGED, LivingEntityMeta.class, LivingEntityMeta::new); // TODO: Implement
|
||||
put(BREEZE, LivingEntityMeta.class, LivingEntityMeta::new); // TODO: Implement
|
||||
put(BREEZE_WIND_CHARGE, SmallFireballMeta.class, SmallFireballMeta::new); // TODO: Verify correctness
|
||||
put(CAMEL, CamelMeta.class, CamelMeta::new); // TODO: Verify correctness
|
||||
put(CAT, CatMeta.class, CatMeta::new);
|
||||
put(CAVE_SPIDER, CaveSpiderMeta.class, CaveSpiderMeta::new);
|
||||
put(CHEST_MINECART, ChestMinecartMeta.class, ChestMinecartMeta::new);
|
||||
put(CHICKEN, ChickenMeta.class, ChickenMeta::new);
|
||||
put(COD, CodMeta.class, CodMeta::new);
|
||||
put(COW, CowMeta.class, CowMeta::new);
|
||||
put(COMMAND_BLOCK_MINECART, CommandBlockMinecartMeta.class, CommandBlockMinecartMeta::new);
|
||||
put(CREEPER, CreeperMeta.class, CreeperMeta::new);
|
||||
put(DOLPHIN, DolphinMeta.class, DolphinMeta::new);
|
||||
put(DONKEY, DonkeyMeta.class, DonkeyMeta::new);
|
||||
put(DRAGON_FIREBALL, DragonFireballMeta.class, DragonFireballMeta::new);
|
||||
put(DROWNED, DrownedMeta.class, DrownedMeta::new);
|
||||
put(EGG, ThrownEggMeta.class, ThrownEggMeta::new);
|
||||
put(ELDER_GUARDIAN, ElderGuardianMeta.class, ElderGuardianMeta::new);
|
||||
put(END_CRYSTAL, EndCrystalMeta.class, EndCrystalMeta::new);
|
||||
put(ENDER_DRAGON, EnderDragonMeta.class, EnderDragonMeta::new);
|
||||
put(ENDERMAN, EndermanMeta.class, EndermanMeta::new);
|
||||
put(ENDERMITE, EndermiteMeta.class, EndermiteMeta::new);
|
||||
put(EVOKER, EvokerMeta.class, EvokerMeta::new);
|
||||
put(EVOKER_FANGS, EvokerFangsMeta.class, EvokerFangsMeta::new);
|
||||
put(FALLING_BLOCK, FallingBlockMeta.class, FallingBlockMeta::new);
|
||||
put(FIREBALL, LargeFireballMeta.class, LargeFireballMeta::new); // TODO: Verify correctness
|
||||
put(FIREWORK_ROCKET, FireworkRocketMeta.class, FireworkRocketMeta::new);
|
||||
put(FISHING_BOBBER, FishingHookMeta.class, FishingHookMeta::new);
|
||||
put(FOX, FoxMeta.class, FoxMeta::new);
|
||||
put(FROG, FrogMeta.class, FrogMeta::new);
|
||||
put(FURNACE_MINECART, FurnaceMinecartMeta.class, FurnaceMinecartMeta::new);
|
||||
put(GIANT, GiantMeta.class, GiantMeta::new);
|
||||
put(GLOW_ITEM_FRAME, GlowItemFrameMeta.class, GlowItemFrameMeta::new);
|
||||
put(GLOW_SQUID, GlowSquidMeta.class, GlowSquidMeta::new);
|
||||
put(GOAT, GoatMeta.class, GoatMeta::new);
|
||||
put(GUARDIAN, GuardianMeta.class, GuardianMeta::new);
|
||||
put(HOGLIN, HoglinMeta.class, HoglinMeta::new);
|
||||
put(HOPPER_MINECART, FurnaceMinecartMeta.class, FurnaceMinecartMeta::new);
|
||||
put(HORSE, HorseMeta.class, HorseMeta::new);
|
||||
put(HUSK, HuskMeta.class, HuskMeta::new);
|
||||
put(ILLUSIONER, IllusionerMeta.class, IllusionerMeta::new);
|
||||
put(INTERACTION, InteractionMeta.class, InteractionMeta::new);
|
||||
put(IRON_GOLEM, IronGolemMeta.class, IronGolemMeta::new);
|
||||
put(ITEM_DISPLAY, ItemDisplayMeta.class, ItemDisplayMeta::new);
|
||||
put(ITEM_FRAME, ItemFrameMeta.class, ItemFrameMeta::new);
|
||||
put(LEASH_KNOT, LeashKnotMeta.class, LeashKnotMeta::new);
|
||||
put(LIGHTNING_BOLT, LightningBoltMeta.class, LightningBoltMeta::new);
|
||||
put(LLAMA, LlamaMeta.class, LlamaMeta::new);
|
||||
put(LLAMA_SPIT, LlamaSpitMeta.class, LlamaSpitMeta::new);
|
||||
put(MAGMA_CUBE, MagmaCubeMeta.class, MagmaCubeMeta::new);
|
||||
put(MARKER, MarkerMeta.class, MarkerMeta::new);
|
||||
put(MULE, MuleMeta.class, MuleMeta::new);
|
||||
put(OCELOT, OcelotMeta.class, OcelotMeta::new);
|
||||
put(PAINTING, PaintingMeta.class, PaintingMeta::new);
|
||||
put(PRIMED_TNT, PrimedTntMeta.class, PrimedTntMeta::new);
|
||||
put(WITHER_SKULL, WitherSkullMeta.class, WitherSkullMeta::new);
|
||||
put(ZOGLIN, ZoglinMeta.class, ZoglinMeta::new);
|
||||
put(WITHER, WitherMeta.class, WitherMeta::new);
|
||||
put(VEX, VexMeta.class, VexMeta::new);
|
||||
put(SPIDER, SpiderMeta.class, SpiderMeta::new);
|
||||
put(SILVERFISH, SilverfishMeta.class, SilverfishMeta::new);
|
||||
put(GUARDIAN, GuardianMeta.class, GuardianMeta::new);
|
||||
put(GIANT, GiantMeta.class, GiantMeta::new);
|
||||
put(ENDERMITE, EndermiteMeta.class, EndermiteMeta::new);
|
||||
put(ENDERMAN, EndermanMeta.class, EndermanMeta::new);
|
||||
put(ELDER_GUARDIAN, ElderGuardianMeta.class, ElderGuardianMeta::new);
|
||||
put(CREEPER, CreeperMeta.class, CreeperMeta::new);
|
||||
put(CAVE_SPIDER, CaveSpiderMeta.class, CaveSpiderMeta::new);
|
||||
put(BLAZE, BlazeMeta.class, BlazeMeta::new);
|
||||
put(PANDA, PandaMeta.class, PandaMeta::new);
|
||||
put(PARROT, ParrotMeta.class, ParrotMeta::new);
|
||||
put(PIG, PigMeta.class, PigMeta::new);
|
||||
put(PIGLIN, PiglinMeta.class, PiglinMeta::new);
|
||||
put(PIGLIN_BRUTE, PiglinBruteMeta.class, PiglinBruteMeta::new);
|
||||
put(EVOKER, EvokerMeta.class, EvokerMeta::new);
|
||||
put(ILLUSIONER, IllusionerMeta.class, IllusionerMeta::new);
|
||||
put(PILLAGER, PillagerMeta.class, PillagerMeta::new);
|
||||
put(PLAYER, PlayerMeta.class, PlayerMeta::new);
|
||||
put(POLAR_BEAR, PolarBearMeta.class, PolarBearMeta::new);
|
||||
put(POTION, ThrownTridentMeta.class, ThrownTridentMeta::new);
|
||||
put(PRIMED_TNT, PrimedTntMeta.class, PrimedTntMeta::new);
|
||||
put(PUFFERFISH, PufferFishMeta.class, PufferFishMeta::new);
|
||||
put(RABBIT, RabbitMeta.class, RabbitMeta::new);
|
||||
put(RAVAGER, RavagerMeta.class, RavagerMeta::new);
|
||||
put(VINDICATOR, VindicatorMeta.class, VindicatorMeta::new);
|
||||
put(WITCH, WitchMeta.class, WitchMeta::new);
|
||||
put(SALMON, SalmonMeta.class, SalmonMeta::new);
|
||||
put(SHEEP, SheepMeta.class, SheepMeta::new);
|
||||
put(SHULKER, ShulkerMeta.class, ShulkerMeta::new);
|
||||
put(SHULKER_BULLET, ShulkerBulletMeta.class, ShulkerBulletMeta::new);
|
||||
put(SILVERFISH, SilverfishMeta.class, SilverfishMeta::new);
|
||||
put(SKELETON, SkeletonMeta.class, SkeletonMeta::new);
|
||||
put(SKELETON_HORSE, SkeletonHorseMeta.class, SkeletonHorseMeta::new);
|
||||
put(SLIME, SlimeMeta.class, SlimeMeta::new);
|
||||
put(SMALL_FIREBALL, SmallFireballMeta.class, SmallFireballMeta::new);
|
||||
put(SNIFFER, SnifferMeta.class, SnifferMeta::new);
|
||||
put(SNOW_GOLEM, SnowGolemMeta.class, SnowGolemMeta::new);
|
||||
put(SPAWNER_MINECART, SpawnerMinecartMeta.class, SpawnerMinecartMeta::new);
|
||||
put(SPIDER, SpiderMeta.class, SpiderMeta::new);
|
||||
put(STRAY, StrayMeta.class, StrayMeta::new);
|
||||
put(STRIDER, StriderMeta.class, StriderMeta::new);
|
||||
put(TADPOLE, LivingEntityMeta.class, LivingEntityMeta::new); // TODO: Implement
|
||||
put(TEXT_DISPLAY, TextDisplayMeta.class, TextDisplayMeta::new);
|
||||
put(THROWN_EXP_BOTTLE, ThrownExpBottleMeta.class, ThrownExpBottleMeta::new);
|
||||
put(TNT_MINECART, TntMinecartMeta.class, TntMinecartMeta::new);
|
||||
put(TRADER_LLAMA, TraderLlamaMeta.class, TraderLlamaMeta::new);
|
||||
put(TRIDENT, ThrownTridentMeta.class, ThrownTridentMeta::new);
|
||||
put(TROPICAL_FISH, TropicalFishMeta.class, TropicalFishMeta::new);
|
||||
put(TURTLE, TurtleMeta.class, TurtleMeta::new);
|
||||
put(VEX, VexMeta.class, VexMeta::new);
|
||||
put(VILLAGER, VillagerMeta.class, VillagerMeta::new);
|
||||
put(VINDICATOR, VindicatorMeta.class, VindicatorMeta::new);
|
||||
put(WANDERING_TRADER, WanderingTraderMeta.class, WanderingTraderMeta::new);
|
||||
put(WARDEN, WardenMeta.class, WardenMeta::new);
|
||||
put(WIND_CHARGE, SmallFireballMeta.class, SmallFireballMeta::new); // TODO: Verify correctness
|
||||
put(WITCH, WitchMeta.class, WitchMeta::new);
|
||||
put(WITHER, WitherMeta.class, WitherMeta::new);
|
||||
put(WITHER_SKELETON, WitherSkeletonMeta.class, WitherSkeletonMeta::new);
|
||||
put(DROWNED, DrownedMeta.class, DrownedMeta::new);
|
||||
put(HUSK, HuskMeta.class, HuskMeta::new);
|
||||
put(WITHER_SKULL, WitherSkullMeta.class, WitherSkullMeta::new);
|
||||
put(WOLF, WolfMeta.class, WolfMeta::new);
|
||||
put(ZOGLIN, ZoglinMeta.class, ZoglinMeta::new);
|
||||
put(ZOMBIE, ZombieMeta.class, ZombieMeta::new);
|
||||
put(ZOMBIE_HORSE, ZombieHorseMeta.class, ZombieHorseMeta::new);
|
||||
put(ZOMBIE_VILLAGER, ZombieVillagerMeta.class, ZombieVillagerMeta::new);
|
||||
put(ZOMBIFIED_PIGLIN, ZombifiedPiglinMeta.class, ZombifiedPiglinMeta::new);
|
||||
put(AXOLOTL, AxolotlMeta.class, AxolotlMeta::new);
|
||||
put(COD, CodMeta.class, CodMeta::new);
|
||||
put(DOLPHIN, DolphinMeta.class, DolphinMeta::new);
|
||||
put(GLOW_SQUID, GlowSquidMeta.class, GlowSquidMeta::new);
|
||||
put(PUFFERFISH, PufferFishMeta.class, PufferFishMeta::new);
|
||||
put(SALMON, SalmonMeta.class, SalmonMeta::new);
|
||||
put(TROPICAL_FISH, TropicalFishMeta.class, TropicalFishMeta::new);
|
||||
put(ARROW, ArrowMeta.class, ArrowMeta::new);
|
||||
put(VILLAGER, VillagerMeta.class, VillagerMeta::new);
|
||||
put(WANDERING_TRADER, WanderingTraderMeta.class, WanderingTraderMeta::new);
|
||||
put(CHEST_MINECART, ChestMinecartMeta.class, ChestMinecartMeta::new);
|
||||
put(COMMAND_BLOCK_MINECART, CommandBlockMinecartMeta.class, CommandBlockMinecartMeta::new);
|
||||
put(FURNACE_MINECART, FurnaceMinecartMeta.class, FurnaceMinecartMeta::new);
|
||||
put(HOPPER_MINECART, FurnaceMinecartMeta.class, FurnaceMinecartMeta::new);
|
||||
put(SPAWNER_MINECART, SpawnerMinecartMeta.class, SpawnerMinecartMeta::new);
|
||||
put(TNT_MINECART, TntMinecartMeta.class, TntMinecartMeta::new);
|
||||
put(PLAYER, PlayerMeta.class, PlayerMeta::new);
|
||||
put(THROWN_EXP_BOTTLE, ThrownExpBottleMeta.class, ThrownExpBottleMeta::new);
|
||||
put(EGG, ThrownEggMeta.class, ThrownEggMeta::new);
|
||||
put(TRIDENT, ThrownTridentMeta.class, ThrownTridentMeta::new);
|
||||
put(POTION, ThrownTridentMeta.class, ThrownTridentMeta::new);
|
||||
put(SMALL_FIREBALL, SmallFireballMeta.class, SmallFireballMeta::new);
|
||||
put(PIG, PigMeta.class, PigMeta::new);
|
||||
put(COW, CowMeta.class, CowMeta::new);
|
||||
put(CHICKEN, ChickenMeta.class, ChickenMeta::new);
|
||||
put(BEE, BeeMeta.class, BeeMeta::new);
|
||||
put(TURTLE, TurtleMeta.class, TurtleMeta::new);
|
||||
put(DONKEY, DonkeyMeta.class, DonkeyMeta::new);
|
||||
put(SHEEP, SheepMeta.class, SheepMeta::new);
|
||||
put(RABBIT, RabbitMeta.class, RabbitMeta::new);
|
||||
put(POLAR_BEAR, PolarBearMeta.class, PolarBearMeta::new);
|
||||
put(OCELOT, OcelotMeta.class, OcelotMeta::new );
|
||||
put(PANDA, PandaMeta.class, PandaMeta::new);
|
||||
put(STRIDER, StriderMeta.class, StriderMeta::new);
|
||||
put(FOX, FoxMeta.class, FoxMeta::new);
|
||||
put(FROG, FrogMeta.class, FrogMeta::new);
|
||||
put(GOAT, GoatMeta.class, GoatMeta::new);
|
||||
put(HOGLIN, HoglinMeta.class, HoglinMeta::new);
|
||||
put(CAT, CatMeta.class, CatMeta::new);
|
||||
put(PARROT, ParrotMeta.class, ParrotMeta::new);
|
||||
put(WOLF, WolfMeta.class, WolfMeta::new);
|
||||
put(DONKEY, DonkeyMeta.class, DonkeyMeta::new);
|
||||
put(HORSE, HorseMeta.class, HorseMeta::new);
|
||||
put(LLAMA, LlamaMeta.class, LlamaMeta::new);
|
||||
put(MULE, MuleMeta.class, MuleMeta::new);
|
||||
put(SKELETON_HORSE, SkeletonHorseMeta.class, SkeletonHorseMeta::new);
|
||||
put(ZOMBIE_HORSE, ZombieHorseMeta.class, ZombieHorseMeta::new);
|
||||
put(SLIME, SlimeMeta.class, SlimeMeta::new);
|
||||
put(MAGMA_CUBE, MagmaCubeMeta.class, MagmaCubeMeta::new);
|
||||
put(SHULKER_BULLET, ShulkerBulletMeta.class, ShulkerBulletMeta::new);
|
||||
put(TRADER_LLAMA, TraderLlamaMeta.class, TraderLlamaMeta::new);
|
||||
put(BAT, BatMeta.class, BatMeta::new);
|
||||
put(IRON_GOLEM, IronGolemMeta.class, IronGolemMeta::new);
|
||||
put(SHULKER, ShulkerMeta.class, ShulkerMeta::new);
|
||||
put(SNOW_GOLEM, SnowGolemMeta.class, SnowGolemMeta::new);
|
||||
}
|
||||
|
||||
private void put(EntityType entityType, Class<? extends EntityMeta> metaClass, BiFunction<Integer, Metadata, EntityMeta> function) {
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package me.tofaa.entitylib.meta.mobs.horse;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import me.tofaa.entitylib.meta.Metadata;
|
||||
|
||||
public class CamelMeta extends BaseHorseMeta {
|
||||
|
||||
public static final byte OFFSET = BaseHorseMeta.MAX_OFFSET;
|
||||
public static final byte MAX_OFFSET = OFFSET + 2;
|
||||
|
||||
public CamelMeta(int entityId, Metadata metadata) {
|
||||
super(entityId, metadata);
|
||||
}
|
||||
|
||||
public boolean isDashing() {
|
||||
return super.metadata.getIndex(OFFSET, false);
|
||||
}
|
||||
|
||||
public void setDashing(boolean value) {
|
||||
super.metadata.setIndex(OFFSET, EntityDataTypes.BOOLEAN, value);
|
||||
}
|
||||
|
||||
public long getLastPoseChangeTick() {
|
||||
return super.metadata.getIndex(offset(OFFSET, 1), 0L);
|
||||
}
|
||||
|
||||
public void setLastPoseChangeTick(long value) {
|
||||
super.metadata.setIndex(offset(OFFSET, 1), EntityDataTypes.LONG, value);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package me.tofaa.entitylib.meta.mobs.monster;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import me.tofaa.entitylib.meta.Metadata;
|
||||
import me.tofaa.entitylib.meta.types.MobMeta;
|
||||
|
||||
public class WardenMeta extends MobMeta {
|
||||
|
||||
public static final byte OFFSET = MobMeta.MAX_OFFSET;
|
||||
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||
|
||||
public WardenMeta(int entityId, Metadata metadata) {
|
||||
super(entityId, metadata);
|
||||
}
|
||||
|
||||
public int getAngerLevel() {
|
||||
return super.metadata.getIndex(OFFSET, 0);
|
||||
}
|
||||
|
||||
public void setAngerLevel(int value) {
|
||||
if (getAngerLevel() == value) {
|
||||
return;
|
||||
}
|
||||
super.metadata.setIndex(OFFSET, EntityDataTypes.INT, value);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package me.tofaa.entitylib.meta.mobs.passive;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.armadillo.ArmadilloState;
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import me.tofaa.entitylib.meta.Metadata;
|
||||
import me.tofaa.entitylib.meta.types.AgeableMeta;
|
||||
|
||||
public class ArmadilloMeta extends AgeableMeta {
|
||||
|
||||
public static final byte OFFSET = AgeableMeta.MAX_OFFSET;
|
||||
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||
|
||||
public ArmadilloMeta(int entityId, Metadata metadata) {
|
||||
super(entityId, metadata);
|
||||
}
|
||||
|
||||
public ArmadilloState getState() {
|
||||
return metadata.getIndex(OFFSET, ArmadilloState.IDLE);
|
||||
}
|
||||
|
||||
public void setState(ArmadilloState state) {
|
||||
super.metadata.setIndex(OFFSET, EntityDataTypes.ARMADILLO_STATE, state);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue