diff --git a/src/main/java/net/minestom/server/entity/EntityCreature.java b/src/main/java/net/minestom/server/entity/EntityCreature.java index ee1de261d..b445709a8 100644 --- a/src/main/java/net/minestom/server/entity/EntityCreature.java +++ b/src/main/java/net/minestom/server/entity/EntityCreature.java @@ -24,7 +24,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -public abstract class EntityCreature extends LivingEntity implements NavigableEntity, EntityAI { +public class EntityCreature extends LivingEntity implements NavigableEntity, EntityAI { private int removalAnimationDelay = 1000; diff --git a/src/main/java/net/minestom/server/entity/metadata/animal/LlamaMeta.java b/src/main/java/net/minestom/server/entity/metadata/animal/LlamaMeta.java index 124f0fedc..606166990 100644 --- a/src/main/java/net/minestom/server/entity/metadata/animal/LlamaMeta.java +++ b/src/main/java/net/minestom/server/entity/metadata/animal/LlamaMeta.java @@ -2,7 +2,6 @@ package net.minestom.server.entity.metadata.animal; import net.minestom.server.entity.Entity; import net.minestom.server.entity.Metadata; -import net.minestom.server.entity.type.animal.EntityLlama; import org.jetbrains.annotations.NotNull; public class LlamaMeta extends ChestedHorseMeta { @@ -31,7 +30,7 @@ public class LlamaMeta extends ChestedHorseMeta { return Variant.VALUES[getMetadata().getIndex((byte) 21, 0)]; } - public void setVariant(EntityLlama.Variant value) { + public void setVariant(Variant value) { getMetadata().setIndex((byte) 21, Metadata.VarInt(value.ordinal())); } diff --git a/src/main/java/net/minestom/server/entity/metadata/monster/EndermineMeta.java b/src/main/java/net/minestom/server/entity/metadata/monster/EndermiteMeta.java similarity index 63% rename from src/main/java/net/minestom/server/entity/metadata/monster/EndermineMeta.java rename to src/main/java/net/minestom/server/entity/metadata/monster/EndermiteMeta.java index 796d0f9b2..9669664ac 100644 --- a/src/main/java/net/minestom/server/entity/metadata/monster/EndermineMeta.java +++ b/src/main/java/net/minestom/server/entity/metadata/monster/EndermiteMeta.java @@ -3,9 +3,9 @@ package net.minestom.server.entity.metadata.monster; import net.minestom.server.entity.Entity; import org.jetbrains.annotations.NotNull; -public class EndermineMeta extends MonsterMeta { +public class EndermiteMeta extends MonsterMeta { - public EndermineMeta(@NotNull Entity entity) { + public EndermiteMeta(@NotNull Entity entity) { super(entity); } diff --git a/src/main/java/net/minestom/server/entity/metadata/monster/raider/SpellcasterIllagerMeta.java b/src/main/java/net/minestom/server/entity/metadata/monster/raider/SpellcasterIllagerMeta.java index 623e3eecb..e2dd97377 100644 --- a/src/main/java/net/minestom/server/entity/metadata/monster/raider/SpellcasterIllagerMeta.java +++ b/src/main/java/net/minestom/server/entity/metadata/monster/raider/SpellcasterIllagerMeta.java @@ -2,7 +2,6 @@ package net.minestom.server.entity.metadata.monster.raider; import net.minestom.server.entity.Entity; import net.minestom.server.entity.Metadata; -import net.minestom.server.entity.type.monster.EntitySpellcasterIllager; import org.jetbrains.annotations.NotNull; public class SpellcasterIllagerMeta extends AbstractIllagerMeta { diff --git a/src/main/java/net/minestom/server/entity/metadata/monster/zombie/ZombieVillagerMeta.java b/src/main/java/net/minestom/server/entity/metadata/monster/zombie/ZombieVillagerMeta.java index ac9deb50c..963eb0d89 100644 --- a/src/main/java/net/minestom/server/entity/metadata/monster/zombie/ZombieVillagerMeta.java +++ b/src/main/java/net/minestom/server/entity/metadata/monster/zombie/ZombieVillagerMeta.java @@ -3,7 +3,6 @@ package net.minestom.server.entity.metadata.monster.zombie; import net.minestom.server.entity.Entity; import net.minestom.server.entity.Metadata; import net.minestom.server.entity.metadata.villager.VillagerMeta; -import net.minestom.server.entity.type.ambient.EntityVillager; import org.jetbrains.annotations.NotNull; public class ZombieVillagerMeta extends ZombieMeta { @@ -28,7 +27,7 @@ public class ZombieVillagerMeta extends ZombieMeta { return new VillagerMeta.VillagerData(VillagerMeta.Type.VALUES[data[0]], VillagerMeta.Profession.VALUES[data[1]], VillagerMeta.Level.VALUES[data[2] - 1]); } - public void setVillagerData(EntityVillager.VillagerData data) { + public void setVillagerData(VillagerMeta.VillagerData data) { getMetadata().setIndex((byte) 17, Metadata.VillagerData( data.getType().ordinal(), data.getProfession().ordinal(), diff --git a/src/main/java/net/minestom/server/entity/metadata/water/fish/TropicalFishMeta.java b/src/main/java/net/minestom/server/entity/metadata/water/fish/TropicalFishMeta.java index d218e57d6..cdbdb6aec 100644 --- a/src/main/java/net/minestom/server/entity/metadata/water/fish/TropicalFishMeta.java +++ b/src/main/java/net/minestom/server/entity/metadata/water/fish/TropicalFishMeta.java @@ -2,7 +2,6 @@ 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.type.water.EntityTropicalFish; import org.jetbrains.annotations.NotNull; public class TropicalFishMeta extends AbstractFishMeta { diff --git a/src/main/java/net/minestom/server/entity/type/ambient/EntityAbstractVillager.java b/src/main/java/net/minestom/server/entity/type/ambient/EntityAbstractVillager.java deleted file mode 100644 index 13f4bd043..000000000 --- a/src/main/java/net/minestom/server/entity/type/ambient/EntityAbstractVillager.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.minestom.server.entity.type.ambient; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.entity.type.AgeableCreature; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityAbstractVillager extends AgeableCreature { - - EntityAbstractVillager(@NotNull EntityType entityType, @NotNull Position spawnPosition) { - super(entityType, spawnPosition); - } - - EntityAbstractVillager(@NotNull EntityType entityType, @NotNull Position spawnPosition, @Nullable Instance instance) { - super(entityType, spawnPosition, instance); - } - - public int getHeadShakeTimer() { - return this.metadata.getIndex((byte) 16, 0); - } - - public void setHeadShakeTimer(int value) { - this.metadata.setIndex((byte) 16, Metadata.VarInt(value)); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/ambient/EntityBat.java b/src/main/java/net/minestom/server/entity/type/ambient/EntityBat.java deleted file mode 100644 index 31e12e671..000000000 --- a/src/main/java/net/minestom/server/entity/type/ambient/EntityBat.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.minestom.server.entity.type.ambient; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.entity.type.AgeableCreature; -import net.minestom.server.entity.type.Animal; -import net.minestom.server.utils.Position; - -public class EntityBat extends AgeableCreature implements Animal { - - public EntityBat(Position spawnPosition) { - super(EntityType.BAT, spawnPosition); - setBoundingBox(0.5f, 0.9f, 0.5f); - } - - /** - * Gets if the bat is hanging. - * - * @return true if the bat is hanging, false otherwise - */ - public boolean isHanging() { - return metadata.getIndex((byte) 15, 0) == 1; - } - - /** - * Makes the bat hanging or cancel. - * - * @param hanging true to make the bat hanging, false otherwise - */ - public void setHanging(boolean hanging) { - this.metadata.setIndex((byte) 15, Metadata.Byte((byte) (hanging ? 1 : 0))); - } -} diff --git a/src/main/java/net/minestom/server/entity/type/ambient/EntityTraderLlama.java b/src/main/java/net/minestom/server/entity/type/ambient/EntityTraderLlama.java deleted file mode 100644 index a7e28221d..000000000 --- a/src/main/java/net/minestom/server/entity/type/ambient/EntityTraderLlama.java +++ /dev/null @@ -1,22 +0,0 @@ -package net.minestom.server.entity.type.ambient; - -import net.minestom.server.entity.EntityCreature; -import net.minestom.server.entity.EntityType; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityTraderLlama extends EntityCreature { - - public EntityTraderLlama(@NotNull Position spawnPosition) { - super(EntityType.TRADER_LLAMA, spawnPosition); - setBoundingBox(.9D, 1.87D, .9D); - } - - public EntityTraderLlama(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.TRADER_LLAMA, spawnPosition, instance); - setBoundingBox(.9D, 1.87D, .9D); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/ambient/EntityVillager.java b/src/main/java/net/minestom/server/entity/type/ambient/EntityVillager.java deleted file mode 100644 index 026ea61de..000000000 --- a/src/main/java/net/minestom/server/entity/type/ambient/EntityVillager.java +++ /dev/null @@ -1,130 +0,0 @@ -package net.minestom.server.entity.type.ambient; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.entity.type.AgeableCreature; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityVillager extends EntityAbstractVillager { - - public EntityVillager(@NotNull Position spawnPosition) { - this(EntityType.VILLAGER, spawnPosition); - } - - public EntityVillager(@NotNull Position spawnPosition, @Nullable Instance instance) { - this(EntityType.VILLAGER, spawnPosition, instance); - } - - EntityVillager(@NotNull EntityType entityType, @NotNull Position spawnPosition) { - super(entityType, spawnPosition); - setBoundingBox(.6D, 1.95D, .6D); - } - - EntityVillager(@NotNull EntityType entityType, @NotNull Position spawnPosition, @Nullable Instance instance) { - super(entityType, spawnPosition, instance); - setBoundingBox(.6D, 1.95D, .6D); - } - - public VillagerData getVillagerData() { - int[] data = this.metadata.getIndex((byte) 17, null); - if (data == null) { - return new VillagerData(Type.PLAINS, Profession.NONE, Level.NOVICE); - } - return new VillagerData(Type.VALUES[data[0]], Profession.VALUES[data[1]], Level.VALUES[data[2] - 1]); - } - - public void setVillagerData(VillagerData data) { - this.metadata.setIndex((byte) 17, Metadata.VillagerData( - data.type.ordinal(), - data.profession.ordinal(), - data.level.ordinal() + 1 - )); - } - - public static class VillagerData { - - private Type type; - private Profession profession; - private Level level; - - public VillagerData(@NotNull Type type, @NotNull Profession profession, @NotNull Level level) { - this.type = type; - this.profession = profession; - this.level = level; - } - - @NotNull - public Type getType() { - return this.type; - } - - public void setType(@NotNull Type type) { - this.type = type; - } - - @NotNull - public Profession getProfession() { - return this.profession; - } - - public void setProfession(@NotNull Profession profession) { - this.profession = profession; - } - - @NotNull - public Level getLevel() { - return level; - } - - public void setLevel(@NotNull Level level) { - this.level = level; - } - } - - public enum Type { - DESERT, - JUNGLE, - PLAINS, - SAVANNA, - SNOW, - SWAMP, - TAIGA; - - public final static Type[] VALUES = values(); - } - - public enum Profession { - NONE, - ARMORER, - BUTCHER, - CARTOGRAPHER, - CLERIC, - FARMER, - FISHERMAN, - FLETCHER, - LEATHERWORKER, - LIBRARIAN, - NITWIT, - UNEMPLOYED, - MASON, - SHEPHERD, - TOOLSMITH, - WEAPONSMITH; - - public final static Profession[] VALUES = values(); - } - - public enum Level { - NOVICE, - APPRENTICE, - JOURNEYMAN, - EXPERT, - MASTER; - - public final static Level[] VALUES = values(); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/ambient/EntityWanderingTrader.java b/src/main/java/net/minestom/server/entity/type/ambient/EntityWanderingTrader.java deleted file mode 100644 index 85df05972..000000000 --- a/src/main/java/net/minestom/server/entity/type/ambient/EntityWanderingTrader.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.minestom.server.entity.type.ambient; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityWanderingTrader extends EntityAbstractVillager { - - public EntityWanderingTrader(@NotNull Position spawnPosition) { - super(EntityType.WANDERING_TRADER, spawnPosition); - } - - public EntityWanderingTrader(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.WANDERING_TRADER, spawnPosition, instance); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntityAbstractHorse.java b/src/main/java/net/minestom/server/entity/type/animal/EntityAbstractHorse.java deleted file mode 100644 index 149212515..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityAbstractHorse.java +++ /dev/null @@ -1,109 +0,0 @@ -package net.minestom.server.entity.type.animal; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.entity.type.AgeableCreature; -import net.minestom.server.entity.type.Animal; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.UUID; - -public class EntityAbstractHorse extends AgeableCreature implements Animal { - - private final static byte TAMED_BIT = 0x02; - private final static byte SADDLED_BIT = 0x04; - private final static byte HAS_BRED_BIT = 0x08; - private final static byte EATING_BIT = 0x10; - private final static byte REARING_BIT = 0x20; - private final static byte MOUTH_OPEN_BIT = 0x40; - - EntityAbstractHorse(@NotNull EntityType entityType, @NotNull Position spawnPosition) { - super(entityType, spawnPosition); - } - - EntityAbstractHorse(@NotNull EntityType entityType, @NotNull Position spawnPosition, @Nullable Instance instance) { - super(entityType, spawnPosition, instance); - } - - public boolean isTamed() { - return (getMask() & TAMED_BIT) != 0; - } - - public void setTamed(boolean value) { - modifyMask(TAMED_BIT, value); - } - - public boolean isSaddled() { - return (getMask() & SADDLED_BIT) != 0; - } - - public void setSaddled(boolean value) { - modifyMask(SADDLED_BIT, value); - } - - public boolean isHasBred() { - return (getMask() & HAS_BRED_BIT) != 0; - } - - public void setHasBred(boolean value) { - modifyMask(HAS_BRED_BIT, value); - } - - public boolean isEating() { - return (getMask() & EATING_BIT) != 0; - } - - public void setEating(boolean value) { - modifyMask(EATING_BIT, value); - } - - public boolean isRearing() { - return (getMask() & REARING_BIT) != 0; - } - - public void setRearing(boolean value) { - modifyMask(REARING_BIT, value); - } - - public boolean isMouthOpen() { - return (getMask() & MOUTH_OPEN_BIT) != 0; - } - - public void setMouthOpen(boolean value) { - modifyMask(MOUTH_OPEN_BIT, value); - } - - public UUID getOwner() { - return this.metadata.getIndex((byte) 17, null); - } - - public void setOwner(UUID value) { - this.metadata.setIndex((byte) 17, Metadata.OptUUID(value)); - } - - private byte getMask() { - return this.metadata.getIndex((byte) 16, (byte) 0); - } - - private void setMask(byte mask) { - this.metadata.setIndex((byte) 16, Metadata.Byte(mask)); - } - - private void modifyMask(byte bit, boolean value) { - byte mask = getMask(); - boolean isPresent = (mask & bit) == bit; - if (isPresent == value) { - return; - } - if (value) { - mask |= bit; - } else { - mask &= ~bit; - } - setMask(mask); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntityBee.java b/src/main/java/net/minestom/server/entity/type/animal/EntityBee.java index d1d0ea8b6..4128ab86a 100644 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityBee.java +++ b/src/main/java/net/minestom/server/entity/type/animal/EntityBee.java @@ -5,6 +5,10 @@ import net.minestom.server.entity.type.AgeableCreature; import net.minestom.server.entity.type.Animal; import net.minestom.server.utils.Position; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.animal.BeeMeta} instead. + */ +@Deprecated public class EntityBee extends AgeableCreature implements Animal { public EntityBee(Position spawnPosition) { super(EntityType.BEE, spawnPosition); diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntityCat.java b/src/main/java/net/minestom/server/entity/type/animal/EntityCat.java index c49b94e9f..a22079b0a 100644 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityCat.java +++ b/src/main/java/net/minestom/server/entity/type/animal/EntityCat.java @@ -8,6 +8,10 @@ import net.minestom.server.utils.Position; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.animal.tameable.CatMeta} instead. + */ +@Deprecated public class EntityCat extends TameableAnimalCreature { public EntityCat(@NotNull Position spawnPosition) { diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntityChestedHorse.java b/src/main/java/net/minestom/server/entity/type/animal/EntityChestedHorse.java deleted file mode 100644 index 15385a79f..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityChestedHorse.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.minestom.server.entity.type.animal; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityChestedHorse extends EntityAbstractHorse { - - EntityChestedHorse(@NotNull EntityType entityType, @NotNull Position spawnPosition) { - super(entityType, spawnPosition); - } - - EntityChestedHorse(@NotNull EntityType entityType, @NotNull Position spawnPosition, @Nullable Instance instance) { - super(entityType, spawnPosition, instance); - } - - public boolean hasChest() { - return this.metadata.getIndex((byte) 18, false); - } - - public void setChest(boolean value) { - this.metadata.setIndex((byte) 18, Metadata.Boolean(value)); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntityChicken.java b/src/main/java/net/minestom/server/entity/type/animal/EntityChicken.java index c9f762234..e7306d8a1 100644 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityChicken.java +++ b/src/main/java/net/minestom/server/entity/type/animal/EntityChicken.java @@ -5,6 +5,10 @@ import net.minestom.server.entity.type.AgeableCreature; import net.minestom.server.entity.type.Animal; import net.minestom.server.utils.Position; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.animal.ChickenMeta} instead. + */ +@Deprecated public class EntityChicken extends AgeableCreature implements Animal { public EntityChicken(Position spawnPosition) { super(EntityType.CHICKEN, spawnPosition); diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntityCow.java b/src/main/java/net/minestom/server/entity/type/animal/EntityCow.java index 40e2e12dc..228a9614a 100644 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityCow.java +++ b/src/main/java/net/minestom/server/entity/type/animal/EntityCow.java @@ -5,6 +5,10 @@ import net.minestom.server.entity.type.AgeableCreature; import net.minestom.server.entity.type.Animal; import net.minestom.server.utils.Position; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.animal.CowMeta} instead. + */ +@Deprecated public class EntityCow extends AgeableCreature implements Animal { public EntityCow(Position spawnPosition) { super(EntityType.COW, spawnPosition); diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntityDolphin.java b/src/main/java/net/minestom/server/entity/type/animal/EntityDolphin.java index 97e81dd65..56a51db92 100644 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityDolphin.java +++ b/src/main/java/net/minestom/server/entity/type/animal/EntityDolphin.java @@ -5,6 +5,10 @@ import net.minestom.server.entity.type.AgeableCreature; import net.minestom.server.entity.type.Animal; import net.minestom.server.utils.Position; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.water.DolphinMeta} instead. + */ +@Deprecated public class EntityDolphin extends AgeableCreature implements Animal { public EntityDolphin(Position spawnPosition) { super(EntityType.DOLPHIN, spawnPosition); diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntityDonkey.java b/src/main/java/net/minestom/server/entity/type/animal/EntityDonkey.java deleted file mode 100644 index 9a522126d..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityDonkey.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.minestom.server.entity.type.animal; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityDonkey extends EntityChestedHorse { - - public EntityDonkey(@NotNull Position spawnPosition) { - super(EntityType.DONKEY, spawnPosition); - setBoundingBox(1.3965D, 1.5D, 1.3965D); - } - - public EntityDonkey(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.DONKEY, spawnPosition, instance); - setBoundingBox(1.3965D, 1.5D, 1.3965D); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntityFox.java b/src/main/java/net/minestom/server/entity/type/animal/EntityFox.java index 18b32beae..8b79e65a6 100644 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityFox.java +++ b/src/main/java/net/minestom/server/entity/type/animal/EntityFox.java @@ -5,6 +5,10 @@ import net.minestom.server.entity.type.AgeableCreature; import net.minestom.server.entity.type.Animal; import net.minestom.server.utils.Position; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.animal.FoxMeta} instead. + */ +@Deprecated public class EntityFox extends AgeableCreature implements Animal { public EntityFox(Position spawnPosition) { super(EntityType.FOX, spawnPosition); diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntityHoglin.java b/src/main/java/net/minestom/server/entity/type/animal/EntityHoglin.java deleted file mode 100644 index 4a061385b..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityHoglin.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.minestom.server.entity.type.animal; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.entity.type.AgeableCreature; -import net.minestom.server.entity.type.Animal; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityHoglin extends AgeableCreature implements Animal { - - public EntityHoglin(@NotNull Position spawnPosition) { - super(EntityType.HOGLIN, spawnPosition); - setBoundingBox(1.3965D, 1.4D, 1.3965D); - } - - public EntityHoglin(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.HOGLIN, spawnPosition, instance); - setBoundingBox(1.3965D, 1.4D, 1.3965D); - } - - public boolean isImmuneToZombification() { - return this.metadata.getIndex((byte) 16, false); - } - - public void setImmuneToZombification(boolean value) { - this.metadata.setIndex((byte) 16, Metadata.Boolean(value)); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntityHorse.java b/src/main/java/net/minestom/server/entity/type/animal/EntityHorse.java deleted file mode 100644 index 2c0bff8e7..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityHorse.java +++ /dev/null @@ -1,93 +0,0 @@ -package net.minestom.server.entity.type.animal; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityHorse extends EntityAbstractHorse { - - public EntityHorse(@NotNull Position spawnPosition) { - super(EntityType.HORSE, spawnPosition); - setBoundingBox(1.3965D, 1.6D, 1.3965D); - } - - public EntityHorse(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.HORSE, spawnPosition, instance); - setBoundingBox(1.3965D, 1.6D, 1.3965D); - } - - public Variant getVariant() { - return getVariantFromID(this.metadata.getIndex((byte) 18, 0)); - } - - public void setVariant(Variant variant) { - this.metadata.setIndex((byte) 18, Metadata.VarInt(getVariantID(variant.marking, variant.color))); - } - - public static int getVariantID(@NotNull Marking marking, @NotNull Color color) { - return (marking.ordinal() << 8) + color.ordinal(); - } - - public static Variant getVariantFromID(int variantID) { - return new Variant( - Marking.VALUES[variantID >> 8], - Color.VALUES[variantID & 0xFF] - ); - } - - public static class Variant { - - private Marking marking; - private Color color; - - public Variant(@NotNull Marking marking, @NotNull Color color) { - this.marking = marking; - this.color = color; - } - - @NotNull - public Marking getMarking() { - return this.marking; - } - - public void setMarking(@NotNull Marking marking) { - this.marking = marking; - } - - @NotNull - public Color getColor() { - return this.color; - } - - public void setColor(@NotNull Color color) { - this.color = color; - } - - } - - public enum Marking { - NONE, - WHITE, - WHITE_FIELD, - WHITE_DOTS, - BLACK_DOTS; - - private final static Marking[] VALUES = values(); - } - - public enum Color { - WHITE, - CREAMY, - CHESTNUT, - BROWN, - BLACK, - GRAY, - DARK_BROWN; - - private final static Color[] VALUES = values(); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntityLlama.java b/src/main/java/net/minestom/server/entity/type/animal/EntityLlama.java index 0f8de5901..be1c1b66b 100644 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityLlama.java +++ b/src/main/java/net/minestom/server/entity/type/animal/EntityLlama.java @@ -1,5 +1,6 @@ package net.minestom.server.entity.type.animal; +import net.minestom.server.entity.EntityCreature; import net.minestom.server.entity.EntityType; import net.minestom.server.entity.Metadata; import net.minestom.server.instance.Instance; @@ -7,7 +8,11 @@ import net.minestom.server.utils.Position; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class EntityLlama extends EntityChestedHorse { +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.animal.LlamaMeta} instead. + */ +@Deprecated +public class EntityLlama extends EntityCreature { public EntityLlama(@NotNull Position spawnPosition) { super(EntityType.LLAMA, spawnPosition); @@ -19,37 +24,4 @@ public class EntityLlama extends EntityChestedHorse { setBoundingBox(.9D, 1.87D, .9D); } - public int getStrength() { - return this.metadata.getIndex((byte) 19, 0); - } - - public void setStrength(int value) { - this.metadata.setIndex((byte) 19, Metadata.VarInt(value)); - } - - public int getCarpetColor() { - return this.metadata.getIndex((byte) 20, -1); - } - - public void setCarpetColor(int value) { - this.metadata.setIndex((byte) 20, Metadata.VarInt(value)); - } - - public Variant getVariant() { - return Variant.VALUES[this.metadata.getIndex((byte) 21, 0)]; - } - - public void setVariant(Variant value) { - this.metadata.setIndex((byte) 21, Metadata.VarInt(value.ordinal())); - } - - public enum Variant { - CREAMY, - WHITE, - BROWN, - GRAY; - - private final static Variant[] VALUES = values(); - } - } diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntityMooshroom.java b/src/main/java/net/minestom/server/entity/type/animal/EntityMooshroom.java index b81a03532..368947ae1 100644 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityMooshroom.java +++ b/src/main/java/net/minestom/server/entity/type/animal/EntityMooshroom.java @@ -7,6 +7,10 @@ import net.minestom.server.entity.type.Animal; import net.minestom.server.utils.Position; import org.jetbrains.annotations.NotNull; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.animal.MooshroomMeta} instead. + */ +@Deprecated public class EntityMooshroom extends AgeableCreature implements Animal { public EntityMooshroom(Position spawnPosition) { diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntityMule.java b/src/main/java/net/minestom/server/entity/type/animal/EntityMule.java deleted file mode 100644 index 0dfe21cd5..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityMule.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.minestom.server.entity.type.animal; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityMule extends EntityChestedHorse { - - public EntityMule(@NotNull Position spawnPosition) { - super(EntityType.MULE, spawnPosition); - setBoundingBox(1.3965D, 1.6D, 1.3965D); - } - - public EntityMule(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.MULE, spawnPosition, instance); - setBoundingBox(1.3965D, 1.6D, 1.3965D); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntityOcelot.java b/src/main/java/net/minestom/server/entity/type/animal/EntityOcelot.java index 2d7a9aebb..0d08f19bf 100644 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityOcelot.java +++ b/src/main/java/net/minestom/server/entity/type/animal/EntityOcelot.java @@ -5,6 +5,10 @@ import net.minestom.server.entity.type.AgeableCreature; import net.minestom.server.entity.type.Animal; import net.minestom.server.utils.Position; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.animal.OcelotMeta} instead. + */ +@Deprecated public class EntityOcelot extends AgeableCreature implements Animal { public EntityOcelot(Position spawnPosition) { super(EntityType.OCELOT, spawnPosition); diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntityPanda.java b/src/main/java/net/minestom/server/entity/type/animal/EntityPanda.java index 0cc5e84cd..11709f376 100644 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityPanda.java +++ b/src/main/java/net/minestom/server/entity/type/animal/EntityPanda.java @@ -5,6 +5,10 @@ import net.minestom.server.entity.type.AgeableCreature; import net.minestom.server.entity.type.Animal; import net.minestom.server.utils.Position; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.animal.PandaMeta} instead. + */ +@Deprecated public class EntityPanda extends AgeableCreature implements Animal { public EntityPanda(Position spawnPosition) { super(EntityType.PANDA, spawnPosition); diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntityParrot.java b/src/main/java/net/minestom/server/entity/type/animal/EntityParrot.java deleted file mode 100644 index 5fd71c3c8..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityParrot.java +++ /dev/null @@ -1,41 +0,0 @@ -package net.minestom.server.entity.type.animal; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.entity.type.TameableAnimalCreature; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityParrot extends TameableAnimalCreature { - - public EntityParrot(@NotNull Position spawnPosition) { - super(EntityType.PARROT, spawnPosition); - setBoundingBox(.5D, .9D, .5D); - } - - public EntityParrot(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.PARROT, spawnPosition, instance); - setBoundingBox(.5D, .9D, .5D); - } - - public Color getColor() { - return Color.VALUES[this.metadata.getIndex((byte) 18, 0)]; - } - - public void setColor(Color value) { - this.metadata.setIndex((byte) 18, Metadata.VarInt(value.ordinal())); - } - - public enum Color { - RED_BLUE, - BLUE, - GREEN, - YELLOW_BLUE, - GREY; - - private final static Color[] VALUES = values(); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntityPig.java b/src/main/java/net/minestom/server/entity/type/animal/EntityPig.java index abbf47523..59acb3728 100644 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityPig.java +++ b/src/main/java/net/minestom/server/entity/type/animal/EntityPig.java @@ -6,6 +6,10 @@ import net.minestom.server.entity.type.AgeableCreature; import net.minestom.server.entity.type.Animal; import net.minestom.server.utils.Position; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.animal.PigMeta} instead. + */ +@Deprecated public class EntityPig extends AgeableCreature implements Animal { public EntityPig(Position spawnPosition) { diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntityPolarBear.java b/src/main/java/net/minestom/server/entity/type/animal/EntityPolarBear.java index b0bb55dd0..ebb0ab8f2 100644 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityPolarBear.java +++ b/src/main/java/net/minestom/server/entity/type/animal/EntityPolarBear.java @@ -6,6 +6,10 @@ import net.minestom.server.entity.type.AgeableCreature; import net.minestom.server.entity.type.Animal; import net.minestom.server.utils.Position; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.animal.PolarBearMeta} instead. + */ +@Deprecated public class EntityPolarBear extends AgeableCreature implements Animal { public EntityPolarBear(Position spawnPosition) { diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntityRabbit.java b/src/main/java/net/minestom/server/entity/type/animal/EntityRabbit.java index a06b397da..841d4e6a4 100644 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityRabbit.java +++ b/src/main/java/net/minestom/server/entity/type/animal/EntityRabbit.java @@ -6,6 +6,10 @@ import net.minestom.server.entity.type.AgeableCreature; import net.minestom.server.entity.type.Animal; import net.minestom.server.utils.Position; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.animal.RabbitMeta} instead. + */ +@Deprecated public class EntityRabbit extends AgeableCreature implements Animal { public EntityRabbit(Position spawnPosition) { diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntitySheep.java b/src/main/java/net/minestom/server/entity/type/animal/EntitySheep.java deleted file mode 100644 index 8bf98c0a9..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntitySheep.java +++ /dev/null @@ -1,63 +0,0 @@ -package net.minestom.server.entity.type.animal; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.entity.type.AgeableCreature; -import net.minestom.server.entity.type.Animal; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntitySheep extends AgeableCreature implements Animal { - - public EntitySheep(@NotNull Position spawnPosition) { - super(EntityType.SHEEP, spawnPosition); - setBoundingBox(.9D, 1.3D, .9D); - } - - public EntitySheep(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.SHEEP, spawnPosition, instance); - setBoundingBox(.9D, 1.3D, .9D); - } - - public int getColor() { - return getMask() & 0x0F; - } - - public void setColor(byte color) { - byte before = getMask(); - byte mask = before; - mask &= ~0x0F; - mask |= (color & 0x0F); - if (mask != before) { - setMask(mask); - } - } - - public boolean isSheared() { - return (getMask() & 0x10) != 0; - } - - public void setSheared(boolean value) { - byte mask = getMask(); - if (((mask & 0x10) != 0) == value) { - return; - } - if (value) { - mask |= 0x10; - } else { - mask &= ~0x10; - } - setMask(mask); - } - - private byte getMask() { - return this.metadata.getIndex((byte) 16, (byte) 0); - } - - private void setMask(byte value) { - this.metadata.setIndex((byte) 16, Metadata.Byte(value)); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntitySkeletonHorse.java b/src/main/java/net/minestom/server/entity/type/animal/EntitySkeletonHorse.java deleted file mode 100644 index 566c1dcd5..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntitySkeletonHorse.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.minestom.server.entity.type.animal; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntitySkeletonHorse extends EntityAbstractHorse { - - public EntitySkeletonHorse(@NotNull Position spawnPosition) { - super(EntityType.SKELETON_HORSE, spawnPosition); - setBoundingBox(1.3965D, 1.6D, 1.3965D); - } - - public EntitySkeletonHorse(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.SKELETON_HORSE, spawnPosition, instance); - setBoundingBox(1.3965D, 1.6D, 1.3965D); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntityStrider.java b/src/main/java/net/minestom/server/entity/type/animal/EntityStrider.java deleted file mode 100644 index 551bbdf54..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityStrider.java +++ /dev/null @@ -1,48 +0,0 @@ -package net.minestom.server.entity.type.animal; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.entity.type.AgeableCreature; -import net.minestom.server.entity.type.Animal; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityStrider extends AgeableCreature implements Animal { - - public EntityStrider(@NotNull Position spawnPosition) { - super(EntityType.STRIDER, spawnPosition); - setBoundingBox(.9D, 1.7D, .9D); - } - - public EntityStrider(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.STRIDER, spawnPosition, instance); - setBoundingBox(.9D, 1.7D, .9D); - } - - public int getTimeToBoost() { - return this.metadata.getIndex((byte) 16, 0); - } - - public void setTimeToBoost(int value) { - this.metadata.setIndex((byte) 16, Metadata.VarInt(value)); - } - - public boolean isShaking() { - return this.metadata.getIndex((byte) 17, false); - } - - public void setShaking(boolean value) { - this.metadata.setIndex((byte) 17, Metadata.Boolean(value)); - } - - public boolean isHasSaddle() { - return this.metadata.getIndex((byte) 18, false); - } - - public void setHasSaddle(boolean value) { - this.metadata.setIndex((byte) 18, Metadata.Boolean(value)); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntityWolf.java b/src/main/java/net/minestom/server/entity/type/animal/EntityWolf.java deleted file mode 100644 index 41ba0248b..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityWolf.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.minestom.server.entity.type.animal; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.entity.type.TameableAnimalCreature; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityWolf extends TameableAnimalCreature { - - public EntityWolf(@NotNull Position spawnPosition) { - super(EntityType.WOLF, spawnPosition); - setBoundingBox(.6D, .85D, .6D); - } - - public EntityWolf(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.WOLF, spawnPosition, instance); - setBoundingBox(.6D, .85D, .6D); - } - - public boolean isBegging() { - return this.metadata.getIndex((byte) 18, false); - } - - public void setBegging(boolean value) { - this.metadata.setIndex((byte) 18, Metadata.Boolean(value)); - } - - public int getCollarColor() { - return this.metadata.getIndex((byte) 19, 14); - } - - public void setCollarColor(int value) { - this.metadata.setIndex((byte) 19, Metadata.VarInt(value)); - } - - public int getAngerTime() { - return this.metadata.getIndex((byte) 20, 0); - } - - public void setAngerTime(int value) { - this.metadata.setIndex((byte) 20, Metadata.VarInt(value)); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/animal/EntityZombieHorse.java b/src/main/java/net/minestom/server/entity/type/animal/EntityZombieHorse.java deleted file mode 100644 index 68060c348..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityZombieHorse.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.minestom.server.entity.type.animal; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityZombieHorse extends EntityAbstractHorse { - - public EntityZombieHorse(@NotNull Position spawnPosition) { - super(EntityType.ZOMBIE_HORSE, spawnPosition); - } - - public EntityZombieHorse(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.ZOMBIE_HORSE, spawnPosition, instance); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/decoration/EntityArmorStand.java b/src/main/java/net/minestom/server/entity/type/decoration/EntityArmorStand.java index e8b473ad5..e245ccd57 100644 --- a/src/main/java/net/minestom/server/entity/type/decoration/EntityArmorStand.java +++ b/src/main/java/net/minestom/server/entity/type/decoration/EntityArmorStand.java @@ -13,6 +13,10 @@ import net.minestom.server.utils.Vector; import net.minestom.server.utils.binary.BitmaskUtil; import org.jetbrains.annotations.NotNull; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.other.ArmorStandMeta} instead. + */ +@Deprecated public class EntityArmorStand extends ObjectEntity implements EquipmentHandler { // Equipments diff --git a/src/main/java/net/minestom/server/entity/type/decoration/EntityItemFrame.java b/src/main/java/net/minestom/server/entity/type/decoration/EntityItemFrame.java index 242e09358..7683a76ce 100644 --- a/src/main/java/net/minestom/server/entity/type/decoration/EntityItemFrame.java +++ b/src/main/java/net/minestom/server/entity/type/decoration/EntityItemFrame.java @@ -10,6 +10,10 @@ import org.jetbrains.annotations.NotNull; // FIXME: https://wiki.vg/Object_Data#Item_Frame_.28id_71.29 // "You have to set both Orientation and Yaw/Pitch accordingly, otherwise it will not work." +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.other.ItemFrameMeta} instead. + */ +@Deprecated public class EntityItemFrame extends ObjectEntity { private final ItemFrameOrientation orientation; diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityBasePiglin.java b/src/main/java/net/minestom/server/entity/type/monster/EntityBasePiglin.java deleted file mode 100644 index 9a445a11d..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityBasePiglin.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.minestom.server.entity.type.monster; - -import net.minestom.server.entity.EntityCreature; -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.entity.type.Monster; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityBasePiglin extends EntityCreature implements Monster { - - EntityBasePiglin(@NotNull EntityType entityType, @NotNull Position spawnPosition) { - super(entityType, spawnPosition); - } - - EntityBasePiglin(@NotNull EntityType entityType, @NotNull Position spawnPosition, @Nullable Instance instance) { - super(entityType, spawnPosition, instance); - } - - public boolean isImmuneToZombification() { - return this.metadata.getIndex((byte) 16, false); - } - - public void setImmuneToZombification(boolean value) { - this.metadata.setIndex((byte) 16, Metadata.Boolean(value)); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityBlaze.java b/src/main/java/net/minestom/server/entity/type/monster/EntityBlaze.java index 5b572a8bb..c3620c5d4 100644 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityBlaze.java +++ b/src/main/java/net/minestom/server/entity/type/monster/EntityBlaze.java @@ -6,6 +6,10 @@ import net.minestom.server.entity.Metadata; import net.minestom.server.entity.type.Monster; import net.minestom.server.utils.Position; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.monster.BlazeMeta} instead. + */ +@Deprecated public class EntityBlaze extends EntityCreature implements Monster { public EntityBlaze(Position spawnPosition) { diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityCaveSpider.java b/src/main/java/net/minestom/server/entity/type/monster/EntityCaveSpider.java index b607f23c9..2ab612f89 100644 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityCaveSpider.java +++ b/src/main/java/net/minestom/server/entity/type/monster/EntityCaveSpider.java @@ -5,6 +5,10 @@ import net.minestom.server.entity.EntityType; import net.minestom.server.entity.type.Monster; import net.minestom.server.utils.Position; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.monster.SpiderMeta} instead. + */ +@Deprecated public class EntityCaveSpider extends EntityCreature implements Monster { public EntityCaveSpider(Position spawnPosition) { super(EntityType.CAVE_SPIDER, spawnPosition); diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityCreeper.java b/src/main/java/net/minestom/server/entity/type/monster/EntityCreeper.java index 8ec9ea27a..4ac1bb2df 100644 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityCreeper.java +++ b/src/main/java/net/minestom/server/entity/type/monster/EntityCreeper.java @@ -7,6 +7,10 @@ import net.minestom.server.entity.type.Monster; import net.minestom.server.utils.Position; import org.jetbrains.annotations.NotNull; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.monster.CreeperMeta} instead. + */ +@Deprecated public class EntityCreeper extends EntityCreature implements Monster { public EntityCreeper(Position spawnPosition) { diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityDrowned.java b/src/main/java/net/minestom/server/entity/type/monster/EntityDrowned.java deleted file mode 100644 index f771fa9bf..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityDrowned.java +++ /dev/null @@ -1,13 +0,0 @@ -package net.minestom.server.entity.type.monster; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; - -public class EntityDrowned extends EntityZombie { - - public EntityDrowned(@NotNull Position spawnPosition) { - super(EntityType.DROWNED, spawnPosition); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityElderGuardian.java b/src/main/java/net/minestom/server/entity/type/monster/EntityElderGuardian.java deleted file mode 100644 index ad5e92b8e..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityElderGuardian.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.minestom.server.entity.type.monster; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityElderGuardian extends EntityGuardian { - - public EntityElderGuardian(@NotNull Position spawnPosition) { - super(EntityType.ELDER_GUARDIAN, spawnPosition); - setBoundingBox(1.9975D, 1.9975D, 1.9975D); - } - - public EntityElderGuardian(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.ELDER_GUARDIAN, spawnPosition, instance); - setBoundingBox(1.9975D, 1.9975D, 1.9975D); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityEnderman.java b/src/main/java/net/minestom/server/entity/type/monster/EntityEnderman.java deleted file mode 100644 index 00818207e..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityEnderman.java +++ /dev/null @@ -1,48 +0,0 @@ -package net.minestom.server.entity.type.monster; - -import net.minestom.server.entity.EntityCreature; -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.entity.type.Monster; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityEnderman extends EntityCreature implements Monster { - - public EntityEnderman(@NotNull Position spawnPosition) { - super(EntityType.ENDERMAN, spawnPosition); - setBoundingBox(.6D, 2.9D, .6D); - } - - public EntityEnderman(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.ENDERMAN, spawnPosition, instance); - setBoundingBox(.6D, 2.9D, .6D); - } - - public Integer getCarriedBlockID() { - return this.metadata.getIndex((byte) 15, null); - } - - public void setCarriedBlockID(@Nullable Integer value) { - this.metadata.setIndex((byte) 15, Metadata.OptBlockID(value)); - } - - public boolean isScreaming() { - return this.metadata.getIndex((byte) 16, false); - } - - public void setScreaming(boolean value) { - this.metadata.setIndex((byte) 16, Metadata.Boolean(value)); - } - - public boolean isStaring() { - return this.metadata.getIndex((byte) 17, false); - } - - public void setStaring(boolean value) { - this.metadata.setIndex((byte) 17, Metadata.Boolean(value)); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityEndermite.java b/src/main/java/net/minestom/server/entity/type/monster/EntityEndermite.java index b951d4abc..85cc67445 100644 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityEndermite.java +++ b/src/main/java/net/minestom/server/entity/type/monster/EntityEndermite.java @@ -2,9 +2,14 @@ package net.minestom.server.entity.type.monster; import net.minestom.server.entity.EntityCreature; import net.minestom.server.entity.EntityType; +import net.minestom.server.entity.metadata.monster.EndermiteMeta; import net.minestom.server.entity.type.Monster; import net.minestom.server.utils.Position; +/** + * @deprecated Use {@link EndermiteMeta} instead. + */ +@Deprecated public class EntityEndermite extends EntityCreature implements Monster { public EntityEndermite(Position spawnPosition) { super(EntityType.ENDERMITE, spawnPosition); diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityEvoker.java b/src/main/java/net/minestom/server/entity/type/monster/EntityEvoker.java deleted file mode 100644 index b3d46f0a6..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityEvoker.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.minestom.server.entity.type.monster; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityEvoker extends EntitySpellcasterIllager { - - public EntityEvoker(@NotNull Position spawnPosition) { - super(EntityType.EVOKER, spawnPosition); - setBoundingBox(.6D, 1.95D, .6D); - } - - public EntityEvoker(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.EVOKER, spawnPosition, instance); - setBoundingBox(.6D, 1.95D, .6D); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityGhast.java b/src/main/java/net/minestom/server/entity/type/monster/EntityGhast.java index 09852cec3..2e318f404 100644 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityGhast.java +++ b/src/main/java/net/minestom/server/entity/type/monster/EntityGhast.java @@ -6,6 +6,10 @@ import net.minestom.server.entity.Metadata; import net.minestom.server.entity.type.Monster; import net.minestom.server.utils.Position; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.flying.GhastMeta} instead. + */ +@Deprecated public class EntityGhast extends EntityCreature implements Monster { public EntityGhast(Position spawnPosition) { diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityGiant.java b/src/main/java/net/minestom/server/entity/type/monster/EntityGiant.java index dc8be9a06..8fc470d3c 100644 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityGiant.java +++ b/src/main/java/net/minestom/server/entity/type/monster/EntityGiant.java @@ -5,6 +5,10 @@ import net.minestom.server.entity.EntityType; import net.minestom.server.entity.type.Monster; import net.minestom.server.utils.Position; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.monster.GiantMeta} instead. + */ +@Deprecated public class EntityGiant extends EntityCreature implements Monster { public EntityGiant(Position spawnPosition) { super(EntityType.GIANT, spawnPosition); diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityGuardian.java b/src/main/java/net/minestom/server/entity/type/monster/EntityGuardian.java index a8b5ccd4c..23b34a76a 100644 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityGuardian.java +++ b/src/main/java/net/minestom/server/entity/type/monster/EntityGuardian.java @@ -10,6 +10,10 @@ import net.minestom.server.utils.Position; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.monster.GuardianMeta} instead. + */ +@Deprecated public class EntityGuardian extends EntityCreature implements Monster { private Entity target; diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityHusk.java b/src/main/java/net/minestom/server/entity/type/monster/EntityHusk.java deleted file mode 100644 index 248fd012c..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityHusk.java +++ /dev/null @@ -1,13 +0,0 @@ -package net.minestom.server.entity.type.monster; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; - -public class EntityHusk extends EntityZombie { - - public EntityHusk(@NotNull Position spawnPosition) { - super(EntityType.HUSK, spawnPosition); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityIllusioner.java b/src/main/java/net/minestom/server/entity/type/monster/EntityIllusioner.java deleted file mode 100644 index 4bd1b8448..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityIllusioner.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.minestom.server.entity.type.monster; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityIllusioner extends EntitySpellcasterIllager { - - public EntityIllusioner(@NotNull Position spawnPosition) { - super(EntityType.ILLUSIONER, spawnPosition); - setBoundingBox(.6D, 1.95D, .6D); - } - - public EntityIllusioner(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.ILLUSIONER, spawnPosition, instance); - setBoundingBox(.6D, 1.95D, .6D); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityMagmaCube.java b/src/main/java/net/minestom/server/entity/type/monster/EntityMagmaCube.java deleted file mode 100644 index fd3075322..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityMagmaCube.java +++ /dev/null @@ -1,13 +0,0 @@ -package net.minestom.server.entity.type.monster; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; - -public class EntityMagmaCube extends EntitySlime { - - public EntityMagmaCube(@NotNull Position spawnPosition) { - super(EntityType.MAGMA_CUBE, spawnPosition); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityPhantom.java b/src/main/java/net/minestom/server/entity/type/monster/EntityPhantom.java index 423dc92ed..94f5f469c 100644 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityPhantom.java +++ b/src/main/java/net/minestom/server/entity/type/monster/EntityPhantom.java @@ -6,6 +6,10 @@ import net.minestom.server.entity.Metadata; import net.minestom.server.entity.type.Monster; import net.minestom.server.utils.Position; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.flying.PhantomMeta} instead. + */ +@Deprecated public class EntityPhantom extends EntityCreature implements Monster { public EntityPhantom(Position spawnPosition) { diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityPiglin.java b/src/main/java/net/minestom/server/entity/type/monster/EntityPiglin.java deleted file mode 100644 index 607004818..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityPiglin.java +++ /dev/null @@ -1,51 +0,0 @@ -package net.minestom.server.entity.type.monster; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityPiglin extends EntityBasePiglin { - - public EntityPiglin(@NotNull Position spawnPosition) { - super(EntityType.PIGLIN, spawnPosition); - setBoundingBox(.6D, 1.95D, .6D); - } - - public EntityPiglin(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.PIGLIN, spawnPosition, instance); - setBoundingBox(.6D, 1.95D, .6D); - } - - public boolean isBaby() { - return this.metadata.getIndex((byte) 16, false); - } - - public void setBaby(boolean value) { - this.metadata.setIndex((byte) 16, Metadata.Boolean(value)); - } - - public boolean isChargingCrossbow() { - return this.metadata.getIndex((byte) 17, false); - } - - public void setChargingCrossbow(boolean value) { - this.metadata.setIndex((byte) 17, Metadata.Boolean(value)); - } - - public boolean isDancing() { - return this.metadata.getIndex((byte) 18, false); - } - - public void setDancing(boolean value) { - this.metadata.setIndex((byte) 18, Metadata.Boolean(value)); - } - - @Override - public double getEyeHeight() { - return isBaby() ? super.getEyeHeight() / 2 : super.getEyeHeight(); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityPiglinBrute.java b/src/main/java/net/minestom/server/entity/type/monster/EntityPiglinBrute.java deleted file mode 100644 index ecbde206e..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityPiglinBrute.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.minestom.server.entity.type.monster; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityPiglinBrute extends EntityBasePiglin { - - public EntityPiglinBrute(@NotNull Position spawnPosition) { - super(EntityType.PIGLIN_BRUTE, spawnPosition); - setBoundingBox(.6D, 1.95D, .6D); - } - - public EntityPiglinBrute(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.PIGLIN_BRUTE, spawnPosition, instance); - setBoundingBox(.6D, 1.95D, .6D); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityPillager.java b/src/main/java/net/minestom/server/entity/type/monster/EntityPillager.java deleted file mode 100644 index 541459283..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityPillager.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.minestom.server.entity.type.monster; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityPillager extends EntityRaider { - - public EntityPillager(@NotNull Position spawnPosition) { - super(EntityType.PILLAGER, spawnPosition); - setBoundingBox(.6D, 1.95D, .6D); - } - - public EntityPillager(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.PILLAGER, spawnPosition, instance); - setBoundingBox(.6D, 1.95D, .6D); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityRaider.java b/src/main/java/net/minestom/server/entity/type/monster/EntityRaider.java deleted file mode 100644 index 92f1fa6e2..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityRaider.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.minestom.server.entity.type.monster; - -import net.minestom.server.entity.EntityCreature; -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.entity.type.Monster; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityRaider extends EntityCreature implements Monster { - - protected EntityRaider(@NotNull EntityType entityType, @NotNull Position spawnPosition) { - super(entityType, spawnPosition); - } - - protected EntityRaider(@NotNull EntityType entityType, @NotNull Position spawnPosition, @Nullable Instance instance) { - super(entityType, spawnPosition, instance); - } - - public boolean isCelebrating() { - return this.metadata.getIndex((byte) 15, false); - } - - public void setCelebrating(boolean value) { - this.metadata.setIndex((byte) 15, Metadata.Boolean(value)); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityRavager.java b/src/main/java/net/minestom/server/entity/type/monster/EntityRavager.java deleted file mode 100644 index daacc9639..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityRavager.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.minestom.server.entity.type.monster; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityRavager extends EntityRaider { - - public EntityRavager(@NotNull Position spawnPosition) { - super(EntityType.RAVAGER, spawnPosition); - setBoundingBox(1.95D, 2.2D, 1.95D); - } - - public EntityRavager(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.RAVAGER, spawnPosition, instance); - setBoundingBox(1.95D, 2.2D, 1.95D); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntitySilverfish.java b/src/main/java/net/minestom/server/entity/type/monster/EntitySilverfish.java index b9bd87c37..f7f0df93e 100644 --- a/src/main/java/net/minestom/server/entity/type/monster/EntitySilverfish.java +++ b/src/main/java/net/minestom/server/entity/type/monster/EntitySilverfish.java @@ -5,6 +5,10 @@ import net.minestom.server.entity.EntityType; import net.minestom.server.entity.type.Monster; import net.minestom.server.utils.Position; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.monster.SilverfishMeta} instead. + */ +@Deprecated public class EntitySilverfish extends EntityCreature implements Monster { public EntitySilverfish(Position spawnPosition) { super(EntityType.SILVERFISH, spawnPosition); diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntitySkeleton.java b/src/main/java/net/minestom/server/entity/type/monster/EntitySkeleton.java deleted file mode 100644 index 325e6cb7a..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntitySkeleton.java +++ /dev/null @@ -1,31 +0,0 @@ -package net.minestom.server.entity.type.monster; - -import net.minestom.server.entity.EntityCreature; -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.type.Monster; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntitySkeleton extends EntityCreature implements Monster { - - public EntitySkeleton(@NotNull Position spawnPosition) { - this(EntityType.SKELETON, spawnPosition); - setBoundingBox(.6D, 1.99D, .6D); - } - - public EntitySkeleton(@NotNull Position spawnPosition, @Nullable Instance instance) { - this(EntityType.SKELETON, spawnPosition, instance); - setBoundingBox(.6D, 1.99D, .6D); - } - - EntitySkeleton(@NotNull EntityType entityType, @NotNull Position spawnPosition) { - super(entityType, spawnPosition); - } - - EntitySkeleton(@NotNull EntityType entityType, @NotNull Position spawnPosition, @Nullable Instance instance) { - super(entityType, spawnPosition, instance); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntitySlime.java b/src/main/java/net/minestom/server/entity/type/monster/EntitySlime.java index 192167f62..3da2b83bc 100644 --- a/src/main/java/net/minestom/server/entity/type/monster/EntitySlime.java +++ b/src/main/java/net/minestom/server/entity/type/monster/EntitySlime.java @@ -7,6 +7,10 @@ import net.minestom.server.entity.type.Monster; import net.minestom.server.utils.Position; import org.jetbrains.annotations.NotNull; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.other.SlimeMeta} instead. + */ +@Deprecated public class EntitySlime extends EntityCreature implements Monster { public EntitySlime(@NotNull Position spawnPosition) { diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntitySpellcasterIllager.java b/src/main/java/net/minestom/server/entity/type/monster/EntitySpellcasterIllager.java deleted file mode 100644 index 654d4171c..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntitySpellcasterIllager.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.minestom.server.entity.type.monster; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntitySpellcasterIllager extends EntityRaider { - - protected EntitySpellcasterIllager(@NotNull EntityType entityType, @NotNull Position spawnPosition) { - super(entityType, spawnPosition); - } - - protected EntitySpellcasterIllager(@NotNull EntityType entityType, @NotNull Position spawnPosition, @Nullable Instance instance) { - super(entityType, spawnPosition, instance); - } - - public Spell getSpell() { - return Spell.VALUES[this.metadata.getIndex((byte) 16, (byte) 0)]; - } - - public void setSpell(Spell spell) { - this.metadata.setIndex((byte) 16, Metadata.Byte((byte) spell.ordinal())); - } - - public enum Spell { - NONE, - SUMMON_VEX, - ATTACK, - WOLOLO, - DISAPPEAR, - BLINDNESS; - - private final static Spell[] VALUES = values(); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntitySpider.java b/src/main/java/net/minestom/server/entity/type/monster/EntitySpider.java index 3a656f912..2cb346470 100644 --- a/src/main/java/net/minestom/server/entity/type/monster/EntitySpider.java +++ b/src/main/java/net/minestom/server/entity/type/monster/EntitySpider.java @@ -6,6 +6,10 @@ import net.minestom.server.entity.Metadata; import net.minestom.server.entity.type.Monster; import net.minestom.server.utils.Position; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.monster.SpiderMeta} instead. + */ +@Deprecated public class EntitySpider extends EntityCreature implements Monster { public EntitySpider(Position spawnPosition) { diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityStray.java b/src/main/java/net/minestom/server/entity/type/monster/EntityStray.java deleted file mode 100644 index f34b5321f..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityStray.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.minestom.server.entity.type.monster; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityStray extends EntitySkeleton { - - public EntityStray(@NotNull Position spawnPosition) { - super(EntityType.STRAY, spawnPosition); - setBoundingBox(.6D, 1.99D, .6D); - } - - public EntityStray(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.STRAY, spawnPosition, instance); - setBoundingBox(.6D, 1.99D, .6D); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityVex.java b/src/main/java/net/minestom/server/entity/type/monster/EntityVex.java deleted file mode 100644 index d87dd956e..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityVex.java +++ /dev/null @@ -1,56 +0,0 @@ -package net.minestom.server.entity.type.monster; - -import net.minestom.server.entity.EntityCreature; -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.entity.type.Monster; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityVex extends EntityCreature implements Monster { - - private final static byte ATTACKING_BIT = 0x1; - - public EntityVex(@NotNull Position spawnPosition) { - super(EntityType.VEX, spawnPosition); - setBoundingBox(.4D, .8D, .4D); - } - - public EntityVex(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.VEX, spawnPosition, instance); - setBoundingBox(.4D, .8D, .4D); - } - - public boolean isAttacking() { - return (getMask() & ATTACKING_BIT) != 0; - } - - public void setAttacking(boolean value) { - modifyMask(ATTACKING_BIT, value); - } - - private byte getMask() { - return this.metadata.getIndex((byte) 15, (byte) 0); - } - - private void setMask(byte mask) { - this.metadata.setIndex((byte) 15, Metadata.Byte(mask)); - } - - private void modifyMask(byte bit, boolean value) { - byte mask = getMask(); - boolean isPresent = (mask & bit) == bit; - if (isPresent == value) { - return; - } - if (value) { - mask |= bit; - } else { - mask &= ~bit; - } - setMask(mask); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityVindicator.java b/src/main/java/net/minestom/server/entity/type/monster/EntityVindicator.java deleted file mode 100644 index ee3a4ed81..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityVindicator.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.minestom.server.entity.type.monster; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityVindicator extends EntityRaider { - - public EntityVindicator(@NotNull Position spawnPosition) { - super(EntityType.VINDICATOR, spawnPosition); - setBoundingBox(.6D, 1.95D, .6D); - } - - public EntityVindicator(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.VINDICATOR, spawnPosition, instance); - setBoundingBox(.6D, 1.95D, .6D); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityWitch.java b/src/main/java/net/minestom/server/entity/type/monster/EntityWitch.java index 68f9c5743..cc72c6b93 100644 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityWitch.java +++ b/src/main/java/net/minestom/server/entity/type/monster/EntityWitch.java @@ -6,6 +6,10 @@ import net.minestom.server.entity.Metadata; import net.minestom.server.entity.type.Monster; import net.minestom.server.utils.Position; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.monster.raider.WitchMeta} instead. + */ +@Deprecated public class EntityWitch extends EntityCreature implements Monster { public EntityWitch(Position spawnPosition) { diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityWitherSkeleton.java b/src/main/java/net/minestom/server/entity/type/monster/EntityWitherSkeleton.java deleted file mode 100644 index eba35d856..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityWitherSkeleton.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.minestom.server.entity.type.monster; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityWitherSkeleton extends EntitySkeleton { - - public EntityWitherSkeleton(@NotNull Position spawnPosition) { - super(EntityType.WITHER_SKELETON, spawnPosition); - setBoundingBox(.7D, 2.4D, .7D); - } - - public EntityWitherSkeleton(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.WITHER_SKELETON, spawnPosition, instance); - setBoundingBox(.7D, 2.4D, .7D); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityZoglin.java b/src/main/java/net/minestom/server/entity/type/monster/EntityZoglin.java deleted file mode 100644 index 09efaaa58..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityZoglin.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.minestom.server.entity.type.monster; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.type.AgeableCreature; -import net.minestom.server.entity.type.Monster; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityZoglin extends AgeableCreature implements Monster { - - public EntityZoglin(@NotNull Position spawnPosition) { - super(EntityType.ZOGLIN, spawnPosition); - setBoundingBox(1.3965D, 1.4D, 1.3965D); - } - - public EntityZoglin(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.ZOGLIN, spawnPosition, instance); - setBoundingBox(1.3965D, 1.4D, 1.3965D); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityZombie.java b/src/main/java/net/minestom/server/entity/type/monster/EntityZombie.java index 142d41644..598475d31 100644 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityZombie.java +++ b/src/main/java/net/minestom/server/entity/type/monster/EntityZombie.java @@ -7,6 +7,10 @@ import net.minestom.server.entity.type.Monster; import net.minestom.server.utils.Position; import org.jetbrains.annotations.NotNull; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.monster.zombie.ZombieMeta} instead. + */ +@Deprecated public class EntityZombie extends EntityCreature implements Monster { public EntityZombie(@NotNull Position spawnPosition) { diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityZombieVillager.java b/src/main/java/net/minestom/server/entity/type/monster/EntityZombieVillager.java deleted file mode 100644 index ae43d783c..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityZombieVillager.java +++ /dev/null @@ -1,40 +0,0 @@ -package net.minestom.server.entity.type.monster; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.entity.type.ambient.EntityAbstractVillager; -import net.minestom.server.entity.type.ambient.EntityVillager; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; - -public class EntityZombieVillager extends EntityZombie { - - public EntityZombieVillager(@NotNull Position spawnPosition) { - super(EntityType.ZOMBIE_VILLAGER, spawnPosition); - } - - public boolean isConverting() { - return this.metadata.getIndex((byte) 18, false); - } - - public void setConverting(boolean value) { - this.metadata.setIndex((byte) 18, Metadata.Boolean(value)); - } - - public EntityVillager.VillagerData getVillagerData() { - int[] data = this.metadata.getIndex((byte) 17, null); - if (data == null) { - return new EntityVillager.VillagerData(EntityVillager.Type.PLAINS, EntityVillager.Profession.NONE, EntityVillager.Level.NOVICE); - } - return new EntityVillager.VillagerData(EntityVillager.Type.VALUES[data[0]], EntityVillager.Profession.VALUES[data[1]], EntityVillager.Level.VALUES[data[2] - 1]); - } - - public void setVillagerData(EntityVillager.VillagerData data) { - this.metadata.setIndex((byte) 17, Metadata.VillagerData( - data.getType().ordinal(), - data.getProfession().ordinal(), - data.getLevel().ordinal() + 1 - )); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/monster/EntityZombifiedPiglin.java b/src/main/java/net/minestom/server/entity/type/monster/EntityZombifiedPiglin.java index 7a954a9ee..a3ce5cdd4 100644 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityZombifiedPiglin.java +++ b/src/main/java/net/minestom/server/entity/type/monster/EntityZombifiedPiglin.java @@ -4,6 +4,10 @@ import net.minestom.server.entity.EntityType; import net.minestom.server.utils.Position; import org.jetbrains.annotations.NotNull; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.monster.zombie.ZombifiedPiglinMeta} instead. + */ +@Deprecated public class EntityZombifiedPiglin extends EntityZombie { public EntityZombifiedPiglin(@NotNull Position spawnPosition) { diff --git a/src/main/java/net/minestom/server/entity/type/other/EntityAreaEffectCloud.java b/src/main/java/net/minestom/server/entity/type/other/EntityAreaEffectCloud.java index c8503f040..afb6cdfc0 100644 --- a/src/main/java/net/minestom/server/entity/type/other/EntityAreaEffectCloud.java +++ b/src/main/java/net/minestom/server/entity/type/other/EntityAreaEffectCloud.java @@ -8,6 +8,10 @@ import net.minestom.server.utils.binary.BinaryWriter; import java.util.function.Consumer; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.other.AreaEffectCloudMeta} instead. + */ +@Deprecated public class EntityAreaEffectCloud extends ObjectEntity { public Consumer particleDataConsumer; diff --git a/src/main/java/net/minestom/server/entity/type/other/EntityEndCrystal.java b/src/main/java/net/minestom/server/entity/type/other/EntityEndCrystal.java index 109b039fe..e1a205a66 100644 --- a/src/main/java/net/minestom/server/entity/type/other/EntityEndCrystal.java +++ b/src/main/java/net/minestom/server/entity/type/other/EntityEndCrystal.java @@ -8,6 +8,10 @@ import net.minestom.server.utils.Position; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.other.EndCrystalMeta} instead. + */ +@Deprecated public class EntityEndCrystal extends ObjectEntity { public EntityEndCrystal(@NotNull Position spawnPosition) { diff --git a/src/main/java/net/minestom/server/entity/type/other/EntityIronGolem.java b/src/main/java/net/minestom/server/entity/type/other/EntityIronGolem.java index a0731d8ee..97b5582be 100644 --- a/src/main/java/net/minestom/server/entity/type/other/EntityIronGolem.java +++ b/src/main/java/net/minestom/server/entity/type/other/EntityIronGolem.java @@ -6,6 +6,10 @@ import net.minestom.server.entity.Metadata; import net.minestom.server.entity.type.Constructable; import net.minestom.server.utils.Position; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.golem.IronGolemMeta} instead. + */ +@Deprecated public class EntityIronGolem extends EntityCreature implements Constructable { public EntityIronGolem(Position spawnPosition) { diff --git a/src/main/java/net/minestom/server/entity/type/other/EntityShulker.java b/src/main/java/net/minestom/server/entity/type/other/EntityShulker.java deleted file mode 100644 index 3fd928cc6..000000000 --- a/src/main/java/net/minestom/server/entity/type/other/EntityShulker.java +++ /dev/null @@ -1,61 +0,0 @@ -package net.minestom.server.entity.type.other; - -import net.minestom.server.entity.EntityCreature; -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.entity.type.Constructable; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.BlockPosition; -import net.minestom.server.utils.Direction; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * TODO: update bounding box depending on state - */ -public class EntityShulker extends EntityCreature implements Constructable { - - public EntityShulker(@NotNull Position spawnPosition) { - super(EntityType.SHULKER, spawnPosition); - setBoundingBox(1D, 1D, 1D); - } - - public EntityShulker(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.SHULKER, spawnPosition, instance); - setBoundingBox(1D, 1D, 1D); - } - - public Direction getAttachFace() { - return this.metadata.getIndex((byte) 15, Direction.DOWN); - } - - public void setAttachFace(Direction value) { - this.metadata.setIndex((byte) 15, Metadata.Direction(value)); - } - - public BlockPosition getAttachmentPosition() { - return this.metadata.getIndex((byte) 16, null); - } - - public void setAttachmentPosition(BlockPosition value) { - this.metadata.setIndex((byte) 16, Metadata.OptPosition(value)); - } - - public byte getShieldHeight() { - return this.metadata.getIndex((byte) 17, (byte) 0); - } - - public void setShieldHeight(byte value) { - this.metadata.setIndex((byte) 17, Metadata.Byte(value)); - } - - public byte getColor() { - return this.metadata.getIndex((byte) 18, (byte) 10); - } - - public void setColor(byte value) { - this.metadata.setIndex((byte) 18, Metadata.Byte(value)); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/other/EntitySnowman.java b/src/main/java/net/minestom/server/entity/type/other/EntitySnowman.java index f69fb4ce1..5726ce421 100644 --- a/src/main/java/net/minestom/server/entity/type/other/EntitySnowman.java +++ b/src/main/java/net/minestom/server/entity/type/other/EntitySnowman.java @@ -6,6 +6,10 @@ import net.minestom.server.entity.Metadata; import net.minestom.server.entity.type.Constructable; import net.minestom.server.utils.Position; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.golem.SnowGolemMeta} instead. + */ +@Deprecated public class EntitySnowman extends EntityCreature implements Constructable { public EntitySnowman(Position spawnPosition) { diff --git a/src/main/java/net/minestom/server/entity/type/projectile/EntityAbstractArrow.java b/src/main/java/net/minestom/server/entity/type/projectile/EntityAbstractArrow.java index d910afff6..32af51d08 100644 --- a/src/main/java/net/minestom/server/entity/type/projectile/EntityAbstractArrow.java +++ b/src/main/java/net/minestom/server/entity/type/projectile/EntityAbstractArrow.java @@ -20,9 +20,6 @@ import java.util.stream.Collectors; public class EntityAbstractArrow extends AbstractProjectile { - private final static byte CRITICAL_BIT = 0x01; - private final static byte NO_CLIP_BIT = 0x02; - EntityAbstractArrow(@Nullable Entity shooter, @NotNull EntityType entityType, @NotNull Position spawnPosition) { super(shooter, entityType, spawnPosition); super.hasPhysics = false; @@ -122,52 +119,6 @@ public class EntityAbstractArrow extends AbstractProjectile { return false; } - public void setCritical(boolean value) { - modifyMask(CRITICAL_BIT, value); - } - - public boolean isCritical() { - return (getMask() & CRITICAL_BIT) != 0; - } - - public void setNoClip(boolean value) { - modifyMask(NO_CLIP_BIT, value); - } - - public boolean isNoClip() { - return (getMask() & NO_CLIP_BIT) != 0; - } - - public void setPiercingLevel(byte value) { - this.metadata.setIndex((byte) 8, Metadata.Byte(value)); - } - - public byte getPiercingLevel() { - return this.metadata.getIndex((byte) 8, (byte) 0); - } - - private byte getMask() { - return this.metadata.getIndex((byte) 7, (byte) 0); - } - - private void setMask(byte mask) { - this.metadata.setIndex((byte) 7, Metadata.Byte(mask)); - } - - private void modifyMask(byte bit, boolean value) { - byte mask = getMask(); - boolean isPresent = (mask & bit) == bit; - if (isPresent == value) { - return; - } - if (value) { - mask |= bit; - } else { - mask &= ~bit; - } - setMask(mask); - } - @Override public int getObjectData() { Entity shooter = getShooter(); diff --git a/src/main/java/net/minestom/server/entity/type/projectile/EntityArrow.java b/src/main/java/net/minestom/server/entity/type/projectile/EntityArrow.java index 39bc7ef1c..a82d7ca0d 100644 --- a/src/main/java/net/minestom/server/entity/type/projectile/EntityArrow.java +++ b/src/main/java/net/minestom/server/entity/type/projectile/EntityArrow.java @@ -11,15 +11,6 @@ public class EntityArrow extends EntityAbstractArrow { public EntityArrow(@Nullable Entity shooter, @NotNull Position spawnPosition) { super(shooter, EntityType.ARROW, spawnPosition); - - } - - public void setColor(int value) { - this.metadata.setIndex((byte) 9, Metadata.VarInt(value)); - } - - public int getColor() { - return this.metadata.getIndex((byte) 9, -1); } } diff --git a/src/main/java/net/minestom/server/entity/type/projectile/EntityEyeOfEnder.java b/src/main/java/net/minestom/server/entity/type/projectile/EntityEyeOfEnder.java index 3abdbe66e..0aa0f6cf1 100644 --- a/src/main/java/net/minestom/server/entity/type/projectile/EntityEyeOfEnder.java +++ b/src/main/java/net/minestom/server/entity/type/projectile/EntityEyeOfEnder.java @@ -11,6 +11,10 @@ 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.EyeOfEnderMeta} instead. + */ +@Deprecated public class EntityEyeOfEnder extends AbstractProjectile { public EntityEyeOfEnder(@Nullable Entity shooter, @NotNull Position spawnPosition) { diff --git a/src/main/java/net/minestom/server/entity/type/projectile/EntityPotion.java b/src/main/java/net/minestom/server/entity/type/projectile/EntityPotion.java index c3f216cea..9448e1499 100644 --- a/src/main/java/net/minestom/server/entity/type/projectile/EntityPotion.java +++ b/src/main/java/net/minestom/server/entity/type/projectile/EntityPotion.java @@ -10,6 +10,10 @@ 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 public class EntityPotion extends AbstractProjectile { public EntityPotion(@Nullable Entity shooter, @NotNull Position spawnPosition, @NotNull ItemStack potion) { diff --git a/src/main/java/net/minestom/server/entity/type/vehicle/EntityBoat.java b/src/main/java/net/minestom/server/entity/type/vehicle/EntityBoat.java index 177936714..5590a0f96 100644 --- a/src/main/java/net/minestom/server/entity/type/vehicle/EntityBoat.java +++ b/src/main/java/net/minestom/server/entity/type/vehicle/EntityBoat.java @@ -7,6 +7,10 @@ import net.minestom.server.entity.type.Vehicle; import net.minestom.server.utils.Position; import org.jetbrains.annotations.NotNull; +/** + * @deprecated Use {@link net.minestom.server.entity.metadata.other.BoatMeta} instead. + */ +@Deprecated public class EntityBoat extends ObjectEntity implements Vehicle { public EntityBoat(Position spawnPosition) { diff --git a/src/main/java/net/minestom/server/entity/type/water/EntityAbstractFish.java b/src/main/java/net/minestom/server/entity/type/water/EntityAbstractFish.java deleted file mode 100644 index b1bf08556..000000000 --- a/src/main/java/net/minestom/server/entity/type/water/EntityAbstractFish.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.minestom.server.entity.type.water; - -import net.minestom.server.entity.EntityCreature; -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityAbstractFish extends EntityCreature { - - protected EntityAbstractFish(@NotNull EntityType entityType, @NotNull Position spawnPosition) { - super(entityType, spawnPosition); - } - - protected EntityAbstractFish(@NotNull EntityType entityType, @NotNull Position spawnPosition, @Nullable Instance instance) { - super(entityType, spawnPosition, instance); - } - - public boolean isFromBucket() { - return this.metadata.getIndex((byte) 15, false); - } - - public void setFromBucket(boolean value) { - this.metadata.setIndex((byte) 15, Metadata.Boolean(value)); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/water/EntityCod.java b/src/main/java/net/minestom/server/entity/type/water/EntityCod.java deleted file mode 100644 index c0f6c9cc5..000000000 --- a/src/main/java/net/minestom/server/entity/type/water/EntityCod.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.minestom.server.entity.type.water; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityCod extends EntityAbstractFish { - - public EntityCod(@NotNull Position spawnPosition) { - super(EntityType.COD, spawnPosition); - setBoundingBox(.5D, .3D, .5D); - } - - public EntityCod(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.COD, spawnPosition, instance); - setBoundingBox(.5D, .3D, .5D); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/water/EntityPufferFish.java b/src/main/java/net/minestom/server/entity/type/water/EntityPufferFish.java deleted file mode 100644 index d9f9045b1..000000000 --- a/src/main/java/net/minestom/server/entity/type/water/EntityPufferFish.java +++ /dev/null @@ -1,53 +0,0 @@ -package net.minestom.server.entity.type.water; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityPufferFish extends EntityAbstractFish { - - public EntityPufferFish(@NotNull Position spawnPosition) { - super(EntityType.PUFFERFISH, spawnPosition); - updateBoundingBox(State.UNPUFFED); - } - - public EntityPufferFish(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.PUFFERFISH, spawnPosition, instance); - updateBoundingBox(State.UNPUFFED); - } - - public State getState() { - return State.VALUES[this.metadata.getIndex((byte) 16, 0)]; - } - - public void setState(State state) { - this.metadata.setIndex((byte) 16, Metadata.VarInt(state.ordinal())); - updateBoundingBox(state); - } - - private void updateBoundingBox(State state) { - switch (state) { - case UNPUFFED: - setBoundingBox(.35D, .35D, .35D); - break; - case SEMI_PUFFED: - setBoundingBox(.5D, .5D, .5D); - break; - default: - setBoundingBox(.7D, .7D, .7D); - break; - } - } - - public enum State { - UNPUFFED, - SEMI_PUFFED, - FULLY_PUFFED; - - private final static State[] VALUES = values(); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/water/EntitySalmon.java b/src/main/java/net/minestom/server/entity/type/water/EntitySalmon.java deleted file mode 100644 index dfe609020..000000000 --- a/src/main/java/net/minestom/server/entity/type/water/EntitySalmon.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.minestom.server.entity.type.water; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntitySalmon extends EntityAbstractFish { - - public EntitySalmon(@NotNull Position spawnPosition) { - super(EntityType.SALMON, spawnPosition); - setBoundingBox(.7D, .4D, .7D); - } - - public EntitySalmon(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.SALMON, spawnPosition, instance); - setBoundingBox(.7D, .4D, .7D); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/water/EntitySquid.java b/src/main/java/net/minestom/server/entity/type/water/EntitySquid.java deleted file mode 100644 index 9628538fc..000000000 --- a/src/main/java/net/minestom/server/entity/type/water/EntitySquid.java +++ /dev/null @@ -1,22 +0,0 @@ -package net.minestom.server.entity.type.water; - -import net.minestom.server.entity.EntityCreature; -import net.minestom.server.entity.EntityType; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntitySquid extends EntityCreature { - - public EntitySquid(@NotNull Position spawnPosition) { - super(EntityType.SQUID, spawnPosition); - setBoundingBox(.8D, .8D, .8D); - } - - public EntitySquid(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.SQUID, spawnPosition, instance); - setBoundingBox(.8D, .8D, .8D); - } - -} diff --git a/src/main/java/net/minestom/server/entity/type/water/EntityTropicalFish.java b/src/main/java/net/minestom/server/entity/type/water/EntityTropicalFish.java deleted file mode 100644 index f03613aba..000000000 --- a/src/main/java/net/minestom/server/entity/type/water/EntityTropicalFish.java +++ /dev/null @@ -1,122 +0,0 @@ -package net.minestom.server.entity.type.water; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.instance.Instance; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EntityTropicalFish extends EntityAbstractFish { - - public EntityTropicalFish(@NotNull Position spawnPosition) { - super(EntityType.TROPICAL_FISH, spawnPosition); - setBoundingBox(.5D, .4D, .5D); - } - - public EntityTropicalFish(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.TROPICAL_FISH, spawnPosition, instance); - setBoundingBox(.5D, .4D, .5D); - } - - public Variant getVariant() { - return getVariantFromID(this.metadata.getIndex((byte) 16, 0)); - } - - public void setVariant(Variant variant) { - this.metadata.setIndex((byte) 16, Metadata.VarInt(getVariantID(variant))); - } - - public static int getVariantID(Variant variant) { - int id = 0; - id |= variant.patternColor; - id <<= 8; - id |= variant.bodyColor; - id <<= 8; - id |= variant.pattern.ordinal(); - id <<= 8; - id |= variant.type.ordinal(); - return id; - } - - public static Variant getVariantFromID(int variantID) { - Type type = Type.VALUES[variantID & 0xFF]; - variantID >>= 8; - Pattern pattern = Pattern.VALUES[variantID & 0xFF]; - variantID >>= 8; - byte bodyColor = (byte) (variantID & 0xFF); - variantID >>= 8; - byte patternColor = (byte) (variantID & 0xFF); - return new Variant(type, pattern, bodyColor, patternColor); - } - - public static class Variant { - - private Type type; - private Pattern pattern; - private byte bodyColor; - private byte patternColor; - - public Variant(@NotNull Type type, @NotNull Pattern pattern, byte bodyColor, byte patternColor) { - this.type = type; - this.pattern = pattern; - this.bodyColor = bodyColor; - this.patternColor = patternColor; - } - - @NotNull - public Type getType() { - return this.type; - } - - public void setType(@NotNull Type type) { - this.type = type; - } - - @NotNull - public Pattern getPattern() { - return this.pattern; - } - - public void setPattern(@NotNull Pattern pattern) { - this.pattern = pattern; - } - - public byte getBodyColor() { - return this.bodyColor; - } - - public void setBodyColor(byte bodyColor) { - this.bodyColor = bodyColor; - } - - public byte getPatternColor() { - return this.patternColor; - } - - public void setPatternColor(byte patternColor) { - this.patternColor = patternColor; - } - } - - public enum Type { - SMALL, - LARGE, - INVISIBLE; - - private final static Type[] VALUES = values(); - } - - public enum Pattern { - KOB, // FLOPPER for LARGE fish - SUNSTREAK, // STRIPEY for LARGE fish - SNOOPER, // GLITTER for LARGE fish - DASHER, // BLOCKFISH for LARGE fish - BRINELY, // BETTY for LARGE fish - SPOTTY, // CLAYFISH for LARGE fish - NONE; - - private final static Pattern[] VALUES = values(); - } - -} diff --git a/src/test/java/demo/commands/HorseCommand.java b/src/test/java/demo/commands/HorseCommand.java index 4491649ac..7745caba2 100644 --- a/src/test/java/demo/commands/HorseCommand.java +++ b/src/test/java/demo/commands/HorseCommand.java @@ -5,9 +5,10 @@ import net.minestom.server.command.builder.Arguments; import net.minestom.server.command.builder.Command; import net.minestom.server.command.builder.arguments.ArgumentType; import net.minestom.server.command.builder.exception.ArgumentSyntaxException; +import net.minestom.server.entity.EntityCreature; import net.minestom.server.entity.EntityType; import net.minestom.server.entity.Player; -import net.minestom.server.entity.type.animal.EntityHorse; +import net.minestom.server.entity.metadata.animal.HorseMeta; import java.util.Locale; import java.util.stream.Collectors; @@ -20,8 +21,8 @@ public class HorseCommand extends Command { setCondition(this::condition); setDefaultExecutor(this::defaultExecutor); var babyArg = ArgumentType.Boolean("baby"); - var markingArg = ArgumentType.Enum("marking", EntityHorse.Marking.class); - var colorArg = ArgumentType.Enum("color", EntityHorse.Color.class); + var markingArg = ArgumentType.Enum("marking", HorseMeta.Marking.class); + var colorArg = ArgumentType.Enum("color", HorseMeta.Color.class); setArgumentCallback(this::onBabyError, babyArg); setArgumentCallback(this::onMarkingError, markingArg); setArgumentCallback(this::onColorError, colorArg); @@ -45,14 +46,14 @@ public class HorseCommand extends Command { } private void onMarkingError(CommandSender sender, ArgumentSyntaxException exception) { - String values = Stream.of(EntityHorse.Marking.values()) + String values = Stream.of(HorseMeta.Marking.values()) .map(value -> "'" + value.name().toLowerCase(Locale.ROOT) + "'") .collect(Collectors.joining(", ")); sender.sendMessage("SYNTAX ERROR: '" + exception.getInput() + "' should be replaced by " + values + "."); } private void onColorError(CommandSender sender, ArgumentSyntaxException exception) { - String values = Stream.of(EntityHorse.Color.values()) + String values = Stream.of(HorseMeta.Color.values()) .map(value -> "'" + value.name().toLowerCase(Locale.ROOT) + "'") .collect(Collectors.joining(", ")); sender.sendMessage("SYNTAX ERROR: '" + exception.getInput() + "' should be replaced by " + values + "."); @@ -62,11 +63,12 @@ public class HorseCommand extends Command { var player = (Player) sender; boolean baby = args.get("baby"); - EntityHorse.Marking marking = args.get("marking"); - EntityHorse.Color color = args.get("color"); - var horse = (EntityHorse) EntityType.HORSE.createFromPosition(player.getPosition()); - horse.setBaby(baby); - horse.setVariant(new EntityHorse.Variant(marking, color)); + HorseMeta.Marking marking = args.get("marking"); + HorseMeta.Color color = args.get("color"); + var horse = new EntityCreature(EntityType.HORSE, player.getPosition()); + var meta = new HorseMeta(horse); + meta.setBaby(baby); + meta.setVariant(new HorseMeta.Variant(marking, color)); horse.setInstance(player.getInstance()); } diff --git a/src/test/java/demo/commands/ShootCommand.java b/src/test/java/demo/commands/ShootCommand.java index 8520399ce..8b242ba19 100644 --- a/src/test/java/demo/commands/ShootCommand.java +++ b/src/test/java/demo/commands/ShootCommand.java @@ -7,6 +7,7 @@ import net.minestom.server.command.builder.arguments.ArgumentType; import net.minestom.server.command.builder.exception.ArgumentSyntaxException; import net.minestom.server.entity.Entity; import net.minestom.server.entity.Player; +import net.minestom.server.entity.metadata.arrow.ArrowMeta; import net.minestom.server.entity.type.Projectile; import net.minestom.server.entity.type.projectile.EntityArrow; import net.minestom.server.entity.type.projectile.EntitySpectralArrow; @@ -54,7 +55,8 @@ public class ShootCommand extends Command { break; case "colored": projectile = new EntityArrow(player, pos); - ((EntityArrow) projectile).setColor(ThreadLocalRandom.current().nextInt()); + var meta = new ArrowMeta((Entity) projectile); + meta.setColor(ThreadLocalRandom.current().nextInt()); break; default: return;