From 9e23085c342d106fea1f517d58c07b8dd7e5b239 Mon Sep 17 00:00:00 2001 From: LeoDog896 Date: Wed, 16 Jun 2021 09:17:13 -0400 Subject: [PATCH] Refactor and remove classes --- .../projectile => }/EntityProjectile.java | 2 +- .../minestom/server/entity/ObjectEntity.java | 36 --- .../entity/ai/goal/CombinedAttackGoal.java | 2 +- .../entity/ai/goal/RangedAttackGoal.java | 2 +- .../server/entity/hologram/Hologram.java | 45 ++-- .../minestom/server/entity/type/Ageable.java | 9 - .../server/entity/type/AgeableCreature.java | 35 --- .../minestom/server/entity/type/Animal.java | 4 - .../server/entity/type/Constructable.java | 4 - .../minestom/server/entity/type/Monster.java | 4 - .../server/entity/type/TameableAnimal.java | 4 - .../entity/type/TameableAnimalCreature.java | 71 ----- .../minestom/server/entity/type/Vehicle.java | 4 - .../server/entity/type/animal/EntityBee.java | 17 -- .../server/entity/type/animal/EntityCat.java | 74 ------ .../entity/type/animal/EntityChicken.java | 17 -- .../server/entity/type/animal/EntityCow.java | 17 -- .../entity/type/animal/EntityDolphin.java | 17 -- .../server/entity/type/animal/EntityFox.java | 17 -- .../entity/type/animal/EntityLlama.java | 26 -- .../entity/type/animal/EntityMooshroom.java | 54 ---- .../entity/type/animal/EntityOcelot.java | 17 -- .../entity/type/animal/EntityPanda.java | 17 -- .../server/entity/type/animal/EntityPig.java | 37 --- .../entity/type/animal/EntityPolarBear.java | 27 -- .../entity/type/animal/EntityRabbit.java | 27 -- .../type/decoration/EntityArmorStand.java | 244 ------------------ .../type/decoration/EntityItemFrame.java | 80 ------ .../entity/type/monster/EntityBlaze.java | 25 -- .../entity/type/monster/EntityCaveSpider.java | 17 -- .../entity/type/monster/EntityCreeper.java | 70 ----- .../entity/type/monster/EntityEndermite.java | 18 -- .../entity/type/monster/EntityGhast.java | 27 -- .../entity/type/monster/EntityGiant.java | 17 -- .../entity/type/monster/EntityGuardian.java | 55 ---- .../entity/type/monster/EntityPhantom.java | 27 -- .../entity/type/monster/EntitySilverfish.java | 17 -- .../entity/type/monster/EntitySlime.java | 34 --- .../entity/type/monster/EntitySpider.java | 37 --- .../entity/type/monster/EntityWitch.java | 27 -- .../entity/type/monster/EntityZombie.java | 45 ---- .../type/monster/EntityZombifiedPiglin.java | 17 -- .../type/other/EntityAreaEffectCloud.java | 123 --------- .../entity/type/other/EntityEndCrystal.java | 44 ---- .../entity/type/other/EntityIronGolem.java | 27 -- .../entity/type/other/EntitySnowman.java | 27 -- .../type/projectile/EntityEyeOfEnder.java | 43 --- .../entity/type/projectile/EntityPotion.java | 31 --- .../entity/type/vehicle/EntityBoat.java | 57 ---- .../server/event/entity/EntityShootEvent.java | 3 +- src/test/java/demo/commands/ShootCommand.java | 2 +- 51 files changed, 26 insertions(+), 1674 deletions(-) rename src/main/java/net/minestom/server/entity/{type/projectile => }/EntityProjectile.java (99%) delete mode 100644 src/main/java/net/minestom/server/entity/ObjectEntity.java delete mode 100644 src/main/java/net/minestom/server/entity/type/Ageable.java delete mode 100644 src/main/java/net/minestom/server/entity/type/AgeableCreature.java delete mode 100644 src/main/java/net/minestom/server/entity/type/Animal.java delete mode 100644 src/main/java/net/minestom/server/entity/type/Constructable.java delete mode 100644 src/main/java/net/minestom/server/entity/type/Monster.java delete mode 100644 src/main/java/net/minestom/server/entity/type/TameableAnimal.java delete mode 100644 src/main/java/net/minestom/server/entity/type/TameableAnimalCreature.java delete mode 100644 src/main/java/net/minestom/server/entity/type/Vehicle.java delete mode 100644 src/main/java/net/minestom/server/entity/type/animal/EntityBee.java delete mode 100644 src/main/java/net/minestom/server/entity/type/animal/EntityCat.java delete mode 100644 src/main/java/net/minestom/server/entity/type/animal/EntityChicken.java delete mode 100644 src/main/java/net/minestom/server/entity/type/animal/EntityCow.java delete mode 100644 src/main/java/net/minestom/server/entity/type/animal/EntityDolphin.java delete mode 100644 src/main/java/net/minestom/server/entity/type/animal/EntityFox.java delete mode 100644 src/main/java/net/minestom/server/entity/type/animal/EntityLlama.java delete mode 100644 src/main/java/net/minestom/server/entity/type/animal/EntityMooshroom.java delete mode 100644 src/main/java/net/minestom/server/entity/type/animal/EntityOcelot.java delete mode 100644 src/main/java/net/minestom/server/entity/type/animal/EntityPanda.java delete mode 100644 src/main/java/net/minestom/server/entity/type/animal/EntityPig.java delete mode 100644 src/main/java/net/minestom/server/entity/type/animal/EntityPolarBear.java delete mode 100644 src/main/java/net/minestom/server/entity/type/animal/EntityRabbit.java delete mode 100644 src/main/java/net/minestom/server/entity/type/decoration/EntityArmorStand.java delete mode 100644 src/main/java/net/minestom/server/entity/type/decoration/EntityItemFrame.java delete mode 100644 src/main/java/net/minestom/server/entity/type/monster/EntityBlaze.java delete mode 100644 src/main/java/net/minestom/server/entity/type/monster/EntityCaveSpider.java delete mode 100644 src/main/java/net/minestom/server/entity/type/monster/EntityCreeper.java delete mode 100644 src/main/java/net/minestom/server/entity/type/monster/EntityEndermite.java delete mode 100644 src/main/java/net/minestom/server/entity/type/monster/EntityGhast.java delete mode 100644 src/main/java/net/minestom/server/entity/type/monster/EntityGiant.java delete mode 100644 src/main/java/net/minestom/server/entity/type/monster/EntityGuardian.java delete mode 100644 src/main/java/net/minestom/server/entity/type/monster/EntityPhantom.java delete mode 100644 src/main/java/net/minestom/server/entity/type/monster/EntitySilverfish.java delete mode 100644 src/main/java/net/minestom/server/entity/type/monster/EntitySlime.java delete mode 100644 src/main/java/net/minestom/server/entity/type/monster/EntitySpider.java delete mode 100644 src/main/java/net/minestom/server/entity/type/monster/EntityWitch.java delete mode 100644 src/main/java/net/minestom/server/entity/type/monster/EntityZombie.java delete mode 100644 src/main/java/net/minestom/server/entity/type/monster/EntityZombifiedPiglin.java delete mode 100644 src/main/java/net/minestom/server/entity/type/other/EntityAreaEffectCloud.java delete mode 100644 src/main/java/net/minestom/server/entity/type/other/EntityEndCrystal.java delete mode 100644 src/main/java/net/minestom/server/entity/type/other/EntityIronGolem.java delete mode 100644 src/main/java/net/minestom/server/entity/type/other/EntitySnowman.java delete mode 100644 src/main/java/net/minestom/server/entity/type/projectile/EntityEyeOfEnder.java delete mode 100644 src/main/java/net/minestom/server/entity/type/projectile/EntityPotion.java delete mode 100644 src/main/java/net/minestom/server/entity/type/vehicle/EntityBoat.java diff --git a/src/main/java/net/minestom/server/entity/type/projectile/EntityProjectile.java b/src/main/java/net/minestom/server/entity/EntityProjectile.java similarity index 99% rename from src/main/java/net/minestom/server/entity/type/projectile/EntityProjectile.java rename to src/main/java/net/minestom/server/entity/EntityProjectile.java index 1e5227d79..712c3983b 100644 --- a/src/main/java/net/minestom/server/entity/type/projectile/EntityProjectile.java +++ b/src/main/java/net/minestom/server/entity/EntityProjectile.java @@ -1,4 +1,4 @@ -package net.minestom.server.entity.type.projectile; +package net.minestom.server.entity; import net.minestom.server.entity.Entity; import net.minestom.server.entity.EntityType; diff --git a/src/main/java/net/minestom/server/entity/ObjectEntity.java b/src/main/java/net/minestom/server/entity/ObjectEntity.java deleted file mode 100644 index 50b46dd29..000000000 --- a/src/main/java/net/minestom/server/entity/ObjectEntity.java +++ /dev/null @@ -1,36 +0,0 @@ -package net.minestom.server.entity; - -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; - -/** - * @deprecated Use {@link net.minestom.server.entity.metadata.EntityMeta} that inherits - * {@link net.minestom.server.entity.metadata.ObjectDataProvider} instead. - */ -@Deprecated -public abstract class ObjectEntity extends Entity { - - public ObjectEntity(@NotNull EntityType entityType, @NotNull Position spawnPosition) { - super(entityType, spawnPosition); - setGravity(0.02f, 0.04f, 1.96f); - } - - /** - * Gets the data of this object entity. - * - * @return an object data - * @see here - */ - public abstract int getObjectData(); - - @Override - public void update(long time) { - - } - - @Override - public void spawn() { - - } - -} diff --git a/src/main/java/net/minestom/server/entity/ai/goal/CombinedAttackGoal.java b/src/main/java/net/minestom/server/entity/ai/goal/CombinedAttackGoal.java index c1d26a8b9..88dcfd66e 100644 --- a/src/main/java/net/minestom/server/entity/ai/goal/CombinedAttackGoal.java +++ b/src/main/java/net/minestom/server/entity/ai/goal/CombinedAttackGoal.java @@ -5,7 +5,7 @@ import net.minestom.server.entity.EntityCreature; import net.minestom.server.entity.EntityType; import net.minestom.server.entity.ai.GoalSelector; import net.minestom.server.entity.pathfinding.Navigator; -import net.minestom.server.entity.type.projectile.EntityProjectile; +import net.minestom.server.entity.EntityProjectile; import net.minestom.server.utils.Position; import net.minestom.server.utils.time.Cooldown; import net.minestom.server.utils.time.TimeUnit; diff --git a/src/main/java/net/minestom/server/entity/ai/goal/RangedAttackGoal.java b/src/main/java/net/minestom/server/entity/ai/goal/RangedAttackGoal.java index 56f85ed0e..4332ac8bd 100644 --- a/src/main/java/net/minestom/server/entity/ai/goal/RangedAttackGoal.java +++ b/src/main/java/net/minestom/server/entity/ai/goal/RangedAttackGoal.java @@ -5,7 +5,7 @@ import net.minestom.server.entity.EntityCreature; import net.minestom.server.entity.EntityType; import net.minestom.server.entity.ai.GoalSelector; import net.minestom.server.entity.pathfinding.Navigator; -import net.minestom.server.entity.type.projectile.EntityProjectile; +import net.minestom.server.entity.EntityProjectile; import net.minestom.server.utils.Position; import net.minestom.server.utils.time.Cooldown; import net.minestom.server.utils.time.TimeUnit; diff --git a/src/main/java/net/minestom/server/entity/hologram/Hologram.java b/src/main/java/net/minestom/server/entity/hologram/Hologram.java index 22d4c7596..fc18fa61d 100644 --- a/src/main/java/net/minestom/server/entity/hologram/Hologram.java +++ b/src/main/java/net/minestom/server/entity/hologram/Hologram.java @@ -3,8 +3,10 @@ package net.minestom.server.entity.hologram; import net.kyori.adventure.text.Component; import net.minestom.server.Viewable; import net.minestom.server.chat.JsonMessage; +import net.minestom.server.entity.Entity; +import net.minestom.server.entity.EntityType; import net.minestom.server.entity.Player; -import net.minestom.server.entity.type.decoration.EntityArmorStand; +import net.minestom.server.entity.metadata.other.ArmorStandMeta; import net.minestom.server.instance.Instance; import net.minestom.server.utils.Position; import net.minestom.server.utils.validate.Check; @@ -19,7 +21,7 @@ public class Hologram implements Viewable { private static final float OFFSET_Y = -0.9875f; - private final HologramEntity entity; + private final Entity entity; private Position position; private Component text; @@ -73,8 +75,21 @@ public class Hologram implements Viewable { * @param autoViewable {@code true}if the hologram should be visible automatically, otherwise {@code false}. */ public Hologram(Instance instance, Position spawnPosition, Component text, boolean autoViewable) { - this.entity = new HologramEntity(spawnPosition.clone().add(0, OFFSET_Y, 0)); - this.entity.setInstance(instance); + this.entity = new Entity(EntityType.ARMOR_STAND); + + ArmorStandMeta armorStandMeta = (ArmorStandMeta) entity.getEntityMeta(); + + armorStandMeta.setNotifyAboutChanges(false); + + armorStandMeta.setSmall(true); + armorStandMeta.setHasNoGravity(true); + armorStandMeta.setCustomName(Component.empty()); + armorStandMeta.setCustomNameVisible(true); + armorStandMeta.setInvisible(true); + + armorStandMeta.setNotifyAboutChanges(true); + + this.entity.setInstance(instance, spawnPosition.clone().add(0, OFFSET_Y, 0)); this.entity.setAutoViewable(autoViewable); this.position = spawnPosition; @@ -166,7 +181,7 @@ public class Hologram implements Viewable { * * @return the hologram entity */ - public HologramEntity getEntity() { + public Entity getEntity() { return entity; } @@ -201,24 +216,4 @@ public class Hologram implements Viewable { private void checkRemoved() { Check.stateCondition(isRemoved(), "You cannot interact with a removed Hologram"); } - - - public static class HologramEntity extends EntityArmorStand { - - /** - * Constructs a new {@link HologramEntity} with the given {@code spawnPosition}. - * - * @param spawnPosition The spawn position of this hologram entity. - */ - public HologramEntity(Position spawnPosition) { - super(spawnPosition); - setSmall(true); - - setNoGravity(true); - setCustomName(Component.empty()); - setCustomNameVisible(true); - setInvisible(true); - } - - } } diff --git a/src/main/java/net/minestom/server/entity/type/Ageable.java b/src/main/java/net/minestom/server/entity/type/Ageable.java deleted file mode 100644 index a402447aa..000000000 --- a/src/main/java/net/minestom/server/entity/type/Ageable.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.minestom.server.entity.type; - -public interface Ageable { - - boolean isBaby(); - - void setBaby(boolean value); - -} diff --git a/src/main/java/net/minestom/server/entity/type/AgeableCreature.java b/src/main/java/net/minestom/server/entity/type/AgeableCreature.java deleted file mode 100644 index ace7a0078..000000000 --- a/src/main/java/net/minestom/server/entity/type/AgeableCreature.java +++ /dev/null @@ -1,35 +0,0 @@ -package net.minestom.server.entity.type; - -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 AgeableCreature extends EntityCreature implements Ageable { - - protected AgeableCreature(@NotNull EntityType entityType, @NotNull Position spawnPosition) { - super(entityType, spawnPosition); - } - - protected AgeableCreature(@NotNull EntityType entityType, @NotNull Position spawnPosition, @Nullable Instance instance) { - super(entityType, spawnPosition, instance); - } - - @Override - public boolean isBaby() { - return this.metadata.getIndex((byte) 15, false); - } - - @Override - public void setBaby(boolean value) { - this.metadata.setIndex((byte) 15, 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/Animal.java b/src/main/java/net/minestom/server/entity/type/Animal.java deleted file mode 100644 index db2df4236..000000000 --- a/src/main/java/net/minestom/server/entity/type/Animal.java +++ /dev/null @@ -1,4 +0,0 @@ -package net.minestom.server.entity.type; - -public interface Animal extends Ageable { -} diff --git a/src/main/java/net/minestom/server/entity/type/Constructable.java b/src/main/java/net/minestom/server/entity/type/Constructable.java deleted file mode 100644 index 59e4df64e..000000000 --- a/src/main/java/net/minestom/server/entity/type/Constructable.java +++ /dev/null @@ -1,4 +0,0 @@ -package net.minestom.server.entity.type; - -public interface Constructable { -} diff --git a/src/main/java/net/minestom/server/entity/type/Monster.java b/src/main/java/net/minestom/server/entity/type/Monster.java deleted file mode 100644 index 3c6220e28..000000000 --- a/src/main/java/net/minestom/server/entity/type/Monster.java +++ /dev/null @@ -1,4 +0,0 @@ -package net.minestom.server.entity.type; - -public interface Monster { -} diff --git a/src/main/java/net/minestom/server/entity/type/TameableAnimal.java b/src/main/java/net/minestom/server/entity/type/TameableAnimal.java deleted file mode 100644 index 62bec4516..000000000 --- a/src/main/java/net/minestom/server/entity/type/TameableAnimal.java +++ /dev/null @@ -1,4 +0,0 @@ -package net.minestom.server.entity.type; - -public interface TameableAnimal extends Animal { -} diff --git a/src/main/java/net/minestom/server/entity/type/TameableAnimalCreature.java b/src/main/java/net/minestom/server/entity/type/TameableAnimalCreature.java deleted file mode 100644 index 186d55c80..000000000 --- a/src/main/java/net/minestom/server/entity/type/TameableAnimalCreature.java +++ /dev/null @@ -1,71 +0,0 @@ -package net.minestom.server.entity.type; - -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; - -import java.util.UUID; - -public class TameableAnimalCreature extends AgeableCreature implements TameableAnimal { - - private final static byte SITTING_BIT = 0x1; - private final static byte TAMED_BIT = 0x4; - - protected TameableAnimalCreature(@NotNull EntityType entityType, @NotNull Position spawnPosition) { - super(entityType, spawnPosition); - } - - protected TameableAnimalCreature(@NotNull EntityType entityType, @NotNull Position spawnPosition, @Nullable Instance instance) { - super(entityType, spawnPosition, instance); - } - - public boolean isSitting() { - return (getMask() & SITTING_BIT) != 0; - } - - public void setSitting(boolean value) { - modifyMask(SITTING_BIT, value); - } - - public boolean isTamed() { - return (getMask() & TAMED_BIT) != 0; - } - - public void setTamed(boolean value) { - modifyMask(TAMED_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/Vehicle.java b/src/main/java/net/minestom/server/entity/type/Vehicle.java deleted file mode 100644 index 00f5cca78..000000000 --- a/src/main/java/net/minestom/server/entity/type/Vehicle.java +++ /dev/null @@ -1,4 +0,0 @@ -package net.minestom.server.entity.type; - -public interface Vehicle { -} 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 deleted file mode 100644 index 4128ab86a..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityBee.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.minestom.server.entity.type.animal; - -import net.minestom.server.entity.EntityType; -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); - setBoundingBox(0.7f, 0.6f, 0.7f); - } -} 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 deleted file mode 100644 index a22079b0a..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityCat.java +++ /dev/null @@ -1,74 +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; - -/** - * @deprecated Use {@link net.minestom.server.entity.metadata.animal.tameable.CatMeta} instead. - */ -@Deprecated -public class EntityCat extends TameableAnimalCreature { - - public EntityCat(@NotNull Position spawnPosition) { - super(EntityType.CAT, spawnPosition); - setBoundingBox(.6D, .7D, .6D); - } - - public EntityCat(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.CAT, spawnPosition, instance); - setBoundingBox(.6D, .7D, .6D); - } - - public Color getColor() { - return Color.VALUES[this.metadata.getIndex((byte) 18, 1)]; - } - - public void setColor(Color value) { - this.metadata.setIndex((byte) 18, Metadata.VarInt(value.ordinal())); - } - - public boolean isLying() { - return this.metadata.getIndex((byte) 19, false); - } - - public void setLying(boolean value) { - this.metadata.setIndex((byte) 19, Metadata.Boolean(value)); - } - - public boolean isRelaxed() { - return this.metadata.getIndex((byte) 20, false); - } - - public void setRelaxed(boolean value) { - this.metadata.setIndex((byte) 20, Metadata.Boolean(value)); - } - - public int getCollarColor() { - return this.metadata.getIndex((byte) 21, 14); - } - - public void setCollarColor(int value) { - this.metadata.setIndex((byte) 21, Metadata.VarInt(value)); - } - - public enum Color { - TABBY, - BLACK, - RED, - SIAMESE, - BRITISH_SHORTHAIR, - CALICO, - PERSIAN, - RAGDOLL, - WHITE, - JELLIE, - ALL_BLACK; - - private final static Color[] VALUES = values(); - } -} 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 deleted file mode 100644 index e7306d8a1..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityChicken.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.minestom.server.entity.type.animal; - -import net.minestom.server.entity.EntityType; -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); - setBoundingBox(0.4f, 0.7f, 0.4f); - } -} 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 deleted file mode 100644 index 228a9614a..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityCow.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.minestom.server.entity.type.animal; - -import net.minestom.server.entity.EntityType; -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); - setBoundingBox(0.9f, 1.4f, 0.9f); - } -} 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 deleted file mode 100644 index 56a51db92..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityDolphin.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.minestom.server.entity.type.animal; - -import net.minestom.server.entity.EntityType; -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); - setBoundingBox(0.9f, 0.6f, 0.9f); - } -} 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 deleted file mode 100644 index 8b79e65a6..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityFox.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.minestom.server.entity.type.animal; - -import net.minestom.server.entity.EntityType; -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); - setBoundingBox(0.6f, 0.7f, 0.6f); - } -} 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 deleted file mode 100644 index da945b483..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityLlama.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.minestom.server.entity.type.animal; - -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; - -/** - * @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); - setBoundingBox(.9D, 1.87D, .9D); - } - - public EntityLlama(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.LLAMA, spawnPosition, instance); - setBoundingBox(.9D, 1.87D, .9D); - } - -} 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 deleted file mode 100644 index 368947ae1..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityMooshroom.java +++ /dev/null @@ -1,54 +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.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) { - super(EntityType.MOOSHROOM, spawnPosition); - setBoundingBox(0.9f, 1.4f, 0.9f); - } - - public MooshroomType getMooshroomType() { - final String identifier = metadata.getIndex((byte) 16, "red"); - return MooshroomType.fromIdentifier(identifier); - } - - public void setMooshroomType(@NotNull MooshroomType mooshroomType) { - this.metadata.setIndex((byte) 16, Metadata.String(mooshroomType.getIdentifier())); - } - - public enum MooshroomType { - RED("red"), - BROWN("brown"); - - private final String identifier; - - MooshroomType(String identifier) { - this.identifier = identifier; - } - - @NotNull - private String getIdentifier() { - return identifier; - } - - public static MooshroomType fromIdentifier(String identifier) { - if (identifier.equals("red")) { - return RED; - } else if (identifier.equals("brown")) { - return BROWN; - } - throw new IllegalArgumentException("Weird thing happened"); - } - } -} 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 deleted file mode 100644 index 0d08f19bf..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityOcelot.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.minestom.server.entity.type.animal; - -import net.minestom.server.entity.EntityType; -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); - setBoundingBox(0.6f, 0.7f, 0.6f); - } -} 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 deleted file mode 100644 index 11709f376..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityPanda.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.minestom.server.entity.type.animal; - -import net.minestom.server.entity.EntityType; -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); - setBoundingBox(1.3f, 1.25f, 1.3f); - } -} 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 deleted file mode 100644 index 59acb3728..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityPig.java +++ /dev/null @@ -1,37 +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.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) { - super(EntityType.PIG, spawnPosition); - setBoundingBox(0.9f, 0.9f, 0.9f); - } - - /** - * Gets if the pig has a saddle. - * - * @return true if the pig has a saddle, false otherwise - */ - public boolean hasSaddle() { - return metadata.getIndex((byte) 16, false); - } - - /** - * Sets a saddle to the pig. - * - * @param saddle true to add a saddle, false to remove it - */ - public void setSaddle(boolean saddle) { - this.metadata.setIndex((byte) 16, Metadata.Boolean(saddle)); - } -} 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 deleted file mode 100644 index ebb0ab8f2..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityPolarBear.java +++ /dev/null @@ -1,27 +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.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) { - super(EntityType.POLAR_BEAR, spawnPosition); - setBoundingBox(1.3f, 1.4f, 1.3f); - } - - public boolean isStandingUp() { - return metadata.getIndex((byte) 16, false); - } - - public void setStandingUp(boolean standingUp) { - this.metadata.setIndex((byte) 16, Metadata.Boolean(standingUp)); - } -} 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 deleted file mode 100644 index 841d4e6a4..000000000 --- a/src/main/java/net/minestom/server/entity/type/animal/EntityRabbit.java +++ /dev/null @@ -1,27 +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.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) { - super(EntityType.RABBIT, spawnPosition); - setBoundingBox(0.4f, 0.5f, 0.4f); - } - - public int getType() { - return metadata.getIndex((byte) 16, 0); - } - - public void setType(int type) { - this.metadata.setIndex((byte) 16, Metadata.VarInt(type)); - } -} 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 deleted file mode 100644 index 0942c646f..000000000 --- a/src/main/java/net/minestom/server/entity/type/decoration/EntityArmorStand.java +++ /dev/null @@ -1,244 +0,0 @@ -package net.minestom.server.entity.type.decoration; - -import net.minestom.server.entity.*; -import net.minestom.server.event.EventDispatcher; -import net.minestom.server.event.item.EntityEquipEvent; -import net.minestom.server.inventory.EquipmentHandler; -import net.minestom.server.item.ItemStack; -import net.minestom.server.utils.Position; -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 - private ItemStack mainHandItem; - private ItemStack offHandItem; - - private ItemStack helmet; - private ItemStack chestplate; - private ItemStack leggings; - private ItemStack boots; - - public EntityArmorStand(Position spawnPosition) { - super(EntityType.ARMOR_STAND, spawnPosition); - - // Refresh BoundingBox - setSmall(false); - - setHeadRotation(new Vector(0, 0, 0)); - setBodyRotation(new Vector(0, 0, 0)); - setLeftArmRotation(new Vector(-10f, 0, -10f)); - setRightArmRotation(new Vector(-15f, 0, -10f)); - setLeftLegRotation(new Vector(-1f, 0, -1f)); - setRightLegRotation(new Vector(1, 0, 1)); - - this.mainHandItem = ItemStack.AIR; - this.offHandItem = ItemStack.AIR; - - this.helmet = ItemStack.AIR; - this.chestplate = ItemStack.AIR; - this.leggings = ItemStack.AIR; - this.boots = ItemStack.AIR; - - } - - @Override - protected boolean addViewer0(@NotNull Player player) { - if (!super.addViewer0(player)) { - return false; - } - player.getPlayerConnection().sendPacket(getEquipmentsPacket()); - return true; - } - - @Override - public int getObjectData() { - return 0; - } - - @NotNull - @Override - public ItemStack getItemInMainHand() { - return mainHandItem; - } - - @Override - public void setItemInMainHand(@NotNull ItemStack itemStack) { - this.mainHandItem = getEquipmentItem(itemStack, EquipmentSlot.MAIN_HAND); - syncEquipment(EquipmentSlot.MAIN_HAND); - } - - @NotNull - @Override - public ItemStack getItemInOffHand() { - return offHandItem; - } - - @Override - public void setItemInOffHand(@NotNull ItemStack itemStack) { - this.offHandItem = getEquipmentItem(itemStack, EquipmentSlot.OFF_HAND); - syncEquipment(EquipmentSlot.OFF_HAND); - } - - @NotNull - @Override - public ItemStack getHelmet() { - return helmet; - } - - @Override - public void setHelmet(@NotNull ItemStack itemStack) { - this.helmet = getEquipmentItem(itemStack, EquipmentSlot.HELMET); - syncEquipment(EquipmentSlot.HELMET); - } - - @NotNull - @Override - public ItemStack getChestplate() { - return chestplate; - } - - @Override - public void setChestplate(@NotNull ItemStack itemStack) { - this.chestplate = getEquipmentItem(itemStack, EquipmentSlot.CHESTPLATE); - syncEquipment(EquipmentSlot.CHESTPLATE); - } - - @NotNull - @Override - public ItemStack getLeggings() { - return leggings; - } - - @Override - public void setLeggings(@NotNull ItemStack itemStack) { - this.leggings = getEquipmentItem(itemStack, EquipmentSlot.LEGGINGS); - syncEquipment(EquipmentSlot.LEGGINGS); - } - - @NotNull - @Override - public ItemStack getBoots() { - return boots; - } - - @Override - public void setBoots(@NotNull ItemStack itemStack) { - this.boots = getEquipmentItem(itemStack, EquipmentSlot.BOOTS); - syncEquipment(EquipmentSlot.BOOTS); - } - - public boolean isSmall() { - return (getStateMeta() & 0x01) != 0; - } - - public void setSmall(boolean small) { - final byte state = BitmaskUtil.changeBit(getStateMeta(), (byte) 0x01, (byte) (small ? 1 : 0), (byte) 0); - this.metadata.setIndex((byte) 14, Metadata.Byte(state)); - - if (small) { - setBoundingBox(0.25f, 0.9875f, 0.25f); - } else { - setBoundingBox(0.5f, 1.975f, 0.5f); - } - } - - public boolean hasArms() { - return (getStateMeta() & 0x04) != 0; - } - - public void setHasArms(boolean hasArms) { - final byte state = BitmaskUtil.changeBit(getStateMeta(), (byte) 0x08, (byte) (hasArms ? 1 : 0), (byte) 2); - this.metadata.setIndex((byte) 14, Metadata.Byte(state)); - } - - public boolean hasNoBasePlate() { - return (getStateMeta() & 0x08) != 0; - } - - public void setNoBasePlate(boolean noBasePlate) { - final byte state = BitmaskUtil.changeBit(getStateMeta(), (byte) 0x10, (byte) (noBasePlate ? 1 : 0), (byte) 3); - this.metadata.setIndex((byte) 14, Metadata.Byte(state)); - } - - public boolean hasMarker() { - return (getStateMeta() & 0x10) != 0; - } - - public void setMarker(boolean setMarker) { - final byte state = BitmaskUtil.changeBit(getStateMeta(), (byte) 0x20, (byte) (setMarker ? 1 : 0), (byte) 4); - this.metadata.setIndex((byte) 14, Metadata.Byte(state)); - } - - @NotNull - public Vector getHeadRotation() { - return metadata.getIndex((byte) 15, new Vector(0, 0, 0)); - } - - public void setHeadRotation(@NotNull Vector headRotation) { - this.metadata.setIndex((byte) 15, Metadata.Rotation(headRotation)); - } - - @NotNull - public Vector getBodyRotation() { - return metadata.getIndex((byte) 16, new Vector(0, 0, 0)); - } - - public void setBodyRotation(@NotNull Vector bodyRotation) { - this.metadata.setIndex((byte) 16, Metadata.Rotation(bodyRotation)); - } - - @NotNull - public Vector getLeftArmRotation() { - return metadata.getIndex((byte) 17, new Vector(-10, 0, -10)); - } - - public void setLeftArmRotation(@NotNull Vector leftArmRotation) { - this.metadata.setIndex((byte) 17, Metadata.Rotation(leftArmRotation)); - } - - @NotNull - public Vector getRightArmRotation() { - return metadata.getIndex((byte) 18, new Vector(-15, 0, 10)); - } - - public void setRightArmRotation(@NotNull Vector rightArmRotation) { - this.metadata.setIndex((byte) 18, Metadata.Rotation(rightArmRotation)); - } - - @NotNull - public Vector getLeftLegRotation() { - return metadata.getIndex((byte) 19, new Vector(-1, 0, -1)); - } - - public void setLeftLegRotation(@NotNull Vector leftLegRotation) { - this.metadata.setIndex((byte) 19, Metadata.Rotation(leftLegRotation)); - } - - @NotNull - public Vector getRightLegRotation() { - return metadata.getIndex((byte) 20, new Vector(1, 0, 1)); - } - - public void setRightLegRotation(@NotNull Vector rightLegRotation) { - this.metadata.setIndex((byte) 20, Metadata.Rotation(rightLegRotation)); - } - - private byte getStateMeta() { - return metadata.getIndex((byte) 14, (byte) 0); - } - - // Equipments - - private ItemStack getEquipmentItem(@NotNull ItemStack itemStack, @NotNull EquipmentSlot slot) { - EntityEquipEvent entityEquipEvent = new EntityEquipEvent(this, itemStack, slot); - EventDispatcher.call(entityEquipEvent); - return entityEquipEvent.getEquippedItem(); - } -} 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 deleted file mode 100644 index f3fd2ffe5..000000000 --- a/src/main/java/net/minestom/server/entity/type/decoration/EntityItemFrame.java +++ /dev/null @@ -1,80 +0,0 @@ -package net.minestom.server.entity.type.decoration; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.entity.ObjectEntity; -import net.minestom.server.item.ItemStack; -import net.minestom.server.utils.Position; -import net.minestom.server.utils.Rotation; -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; - - public EntityItemFrame(@NotNull Position spawnPosition, @NotNull ItemFrameOrientation orientation) { - super(EntityType.ITEM_FRAME, spawnPosition); - this.orientation = orientation; - setNoGravity(true); - setGravity(0f, 0f, 0f); - } - - @Override - public int getObjectData() { - return orientation.ordinal(); - } - - /** - * Gets the item stack in the frame. - * - * @return the item stack in the frame - */ - @NotNull - public ItemStack getItemStack() { - return metadata.getIndex((byte) 7, ItemStack.AIR); - } - - /** - * Changes the item stack in the frame. - * - * @param itemStack the new item stack in the frame - */ - public void setItemStack(@NotNull ItemStack itemStack) { - this.metadata.setIndex((byte) 7, Metadata.Slot(itemStack)); - } - - /** - * Gets the item rotation. - * - * @return the item rotation - */ - @NotNull - public Rotation getRotation() { - final int ordinal = metadata.getIndex((byte) 8, 0); - return Rotation.values()[ordinal]; - } - - /** - * Changes the item rotation. - * - * @param rotation the new item rotation - */ - public void setRotation(@NotNull Rotation rotation) { - this.metadata.setIndex((byte) 8, Metadata.VarInt(rotation.ordinal())); - } - - /** - * Represents the orientation of the frame. - */ - public enum ItemFrameOrientation { - DOWN, UP, NORTH, SOUTH, WEST, EAST - } - -} 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 deleted file mode 100644 index c3620c5d4..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityBlaze.java +++ /dev/null @@ -1,25 +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.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) { - super(EntityType.BLAZE, spawnPosition); - setBoundingBox(0.6f, 1.8f, 0.6f); - } - - @Override - public void setOnFire(boolean fire) { - super.setOnFire(fire); - this.metadata.setIndex((byte) 15, Metadata.Byte((byte) (fire ? 1 : 0))); - } -} 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 deleted file mode 100644 index 2ab612f89..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityCaveSpider.java +++ /dev/null @@ -1,17 +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.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); - setBoundingBox(0.7f, 0.5f, 0.7f); - } -} 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 deleted file mode 100644 index 4ac1bb2df..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityCreeper.java +++ /dev/null @@ -1,70 +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.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) { - super(EntityType.CREEPER, spawnPosition); - setBoundingBox(0.6f, 1.7f, 0.6f); - } - - @NotNull - public CreeperState getCreeperState() { - final int state = metadata.getIndex((byte) 15, -1); - return CreeperState.fromState(state); - } - - public void setCreeperState(@NotNull CreeperState creeperState) { - this.metadata.setIndex((byte) 15, Metadata.VarInt(creeperState.getState())); - } - - public boolean isCharged() { - return metadata.getIndex((byte) 16, false); - } - - public void setCharged(boolean charged) { - this.metadata.setIndex((byte) 16, Metadata.Boolean(charged)); - } - - public boolean isIgnited() { - return metadata.getIndex((byte) 17, false); - } - - public void setIgnited(boolean ignited) { - this.metadata.setIndex((byte) 17, Metadata.Boolean(ignited)); - } - - public enum CreeperState { - IDLE(-1), - FUSE(1); - - private final int state; - - CreeperState(int state) { - this.state = state; - } - - private int getState() { - return state; - } - - private static CreeperState fromState(int state) { - if (state == -1) { - return IDLE; - } else if (state == 1) { - return FUSE; - } - throw new IllegalArgumentException("Weird thing happened"); - } - } -} 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 deleted file mode 100644 index 85cc67445..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityEndermite.java +++ /dev/null @@ -1,18 +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.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); - setBoundingBox(0.4f, 0.3f, 0.4f); - } -} 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 deleted file mode 100644 index 2e318f404..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityGhast.java +++ /dev/null @@ -1,27 +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.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) { - super(EntityType.GHAST, spawnPosition); - setBoundingBox(4, 4, 4); - } - - public boolean isAttacking() { - return metadata.getIndex((byte) 15, false); - } - - public void setAttacking(boolean attacking) { - this.metadata.setIndex((byte) 15, Metadata.Boolean(attacking)); - } -} 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 deleted file mode 100644 index 8fc470d3c..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityGiant.java +++ /dev/null @@ -1,17 +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.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); - setBoundingBox(3.6f, 10.8f, 3.6f); - } -} 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 deleted file mode 100644 index 23b34a76a..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityGuardian.java +++ /dev/null @@ -1,55 +0,0 @@ -package net.minestom.server.entity.type.monster; - -import net.minestom.server.entity.Entity; -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; - -/** - * @deprecated Use {@link net.minestom.server.entity.metadata.monster.GuardianMeta} instead. - */ -@Deprecated -public class EntityGuardian extends EntityCreature implements Monster { - - private Entity target; - - public EntityGuardian(@NotNull Position spawnPosition) { - super(EntityType.GUARDIAN, spawnPosition); - setBoundingBox(0.85f, 0.85f, 0.85f); - } - - public EntityGuardian(@NotNull Position spawnPosition, @Nullable Instance instance) { - super(EntityType.GUARDIAN, spawnPosition, instance); - setBoundingBox(0.85f, 0.85f, 0.85f); - } - - EntityGuardian(@NotNull EntityType entityType, @NotNull Position spawnPosition) { - super(entityType, spawnPosition); - } - - EntityGuardian(@NotNull EntityType entityType, @NotNull Position spawnPosition, @Nullable Instance instance) { - super(entityType, spawnPosition, instance); - } - - public boolean isRetractingSpikes() { - return metadata.getIndex((byte) 15, false); - } - - public void setRetractingSpikes(boolean retractingSpikes) { - this.metadata.setIndex((byte) 15, Metadata.Boolean(retractingSpikes)); - } - - public Entity getTarget() { - return target; - } - - public void setTarget(@NotNull Entity target) { - this.target = target; - this.metadata.setIndex((byte) 16, Metadata.VarInt(target.getEntityId())); - } -} 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 deleted file mode 100644 index 94f5f469c..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityPhantom.java +++ /dev/null @@ -1,27 +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.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) { - super(EntityType.PHANTOM, spawnPosition); - setBoundingBox(0.9f, 0.5f, 0.9f); // TODO change based on size - } - - public int getSize() { - return metadata.getIndex((byte) 17, 0); - } - - public void setSize(int size) { - this.metadata.setIndex((byte) 15, Metadata.VarInt(size)); - } -} 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 deleted file mode 100644 index f7f0df93e..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntitySilverfish.java +++ /dev/null @@ -1,17 +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.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); - setBoundingBox(0.4f, 0.3f, 0.4f); - } -} 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 deleted file mode 100644 index 3da2b83bc..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntitySlime.java +++ /dev/null @@ -1,34 +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.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) { - this(EntityType.SLIME, spawnPosition); - } - - EntitySlime(@NotNull EntityType type, @NotNull Position spawnPosition) { - super(type, spawnPosition); - setSize(1); - } - - public int getSize() { - return metadata.getIndex((byte) 15, 1); - } - - public void setSize(int size) { - final float boxSize = 0.51000005f * size; - setBoundingBox(boxSize, boxSize, boxSize); - this.metadata.setIndex((byte) 15, Metadata.VarInt(size)); - } -} 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 deleted file mode 100644 index 2cb346470..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntitySpider.java +++ /dev/null @@ -1,37 +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.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) { - super(EntityType.SPIDER, spawnPosition); - setBoundingBox(1.4f, 0.9f, 1.4f); - } - - /** - * Gets if the spider is climbing. - * - * @return true if the spider is climbing, false otherwise - */ - public boolean isClimbing() { - return metadata.getIndex((byte) 15, false); - } - - /** - * Makes the spider climbs. - * - * @param climbing true to make the spider climbs, false otherwise - */ - public void setClimbing(boolean climbing) { - this.metadata.setIndex((byte) 15, Metadata.Boolean(climbing)); - } -} 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 deleted file mode 100644 index cc72c6b93..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityWitch.java +++ /dev/null @@ -1,27 +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.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) { - super(EntityType.WITCH, spawnPosition); - setBoundingBox(0.6f, 1.95f, 0.6f); - } - - public boolean isDrinkingPotion() { - return metadata.getIndex((byte) 16, false); - } - - public void setDrinkingPotion(boolean drinkingPotion) { - this.metadata.setIndex((byte) 16, Metadata.Boolean(drinkingPotion)); - } -} 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 deleted file mode 100644 index 598475d31..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityZombie.java +++ /dev/null @@ -1,45 +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.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) { - this(EntityType.ZOMBIE, spawnPosition); - } - - EntityZombie(@NotNull EntityType entityType, @NotNull Position spawnPosition) { - super(entityType, spawnPosition); - setBoundingBox(0.6f, 1.95f, 0.6f); - } - - public boolean isBaby() { - return metadata.getIndex((byte) 15, false); - } - - public void setBaby(boolean baby) { - this.metadata.setIndex((byte) 15, Metadata.Boolean(baby)); - } - - public boolean isBecomingDrowned() { - return metadata.getIndex((byte) 17, false); - } - - public void setBecomingDrowned(boolean becomingDrowned) { - this.metadata.setIndex((byte) 17, Metadata.Boolean(becomingDrowned)); - } - - @Override - public double getEyeHeight() { - return isBaby() ? 0.93 : 1.74; - } -} 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 deleted file mode 100644 index a3ce5cdd4..000000000 --- a/src/main/java/net/minestom/server/entity/type/monster/EntityZombifiedPiglin.java +++ /dev/null @@ -1,17 +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; - -/** - * @deprecated Use {@link net.minestom.server.entity.metadata.monster.zombie.ZombifiedPiglinMeta} instead. - */ -@Deprecated -public class EntityZombifiedPiglin extends EntityZombie { - - public EntityZombifiedPiglin(@NotNull Position spawnPosition) { - super(EntityType.ZOMBIFIED_PIGLIN, 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 deleted file mode 100644 index a7e6ddb5e..000000000 --- a/src/main/java/net/minestom/server/entity/type/other/EntityAreaEffectCloud.java +++ /dev/null @@ -1,123 +0,0 @@ -package net.minestom.server.entity.type.other; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.ObjectEntity; -import net.minestom.server.particle.Particle; -import net.minestom.server.utils.Position; -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; - private float radius; - private int color; - private boolean ignoreRadius; - private Particle particleType; - - public EntityAreaEffectCloud(Position spawnPosition) { - super(EntityType.AREA_EFFECT_CLOUD, spawnPosition); - setRadius(0.5f); - setColor(0); - setIgnoreRadius(false); - setParticle(Particle.EFFECT); - setParticleDataConsumer(packetWriter -> { - }); - } - - /*@NotNull - @Override - public Consumer getMetadataConsumer() { - return packet -> { - super.getMetadataConsumer().accept(packet); - fillMetadataIndex(packet, 7); - fillMetadataIndex(packet, 8); - fillMetadataIndex(packet, 9); - fillMetadataIndex(packet, 10); - }; - }*/ - - /*@Override - protected void fillMetadataIndex(@NotNull BinaryWriter packet, int index) { - super.fillMetadataIndex(packet, index); - if (index == 7) { - packet.writeByte((byte) 7); - packet.writeByte(METADATA_FLOAT); - packet.writeFloat(radius); - } else if (index == 8) { - packet.writeByte((byte) 8); - packet.writeByte(METADATA_VARINT); - packet.writeVarInt(color); - } else if (index == 9) { - packet.writeByte((byte) 9); - packet.writeByte(METADATA_BOOLEAN); - packet.writeBoolean(ignoreRadius); - } else if (index == 10) { - packet.writeByte((byte) 10); - packet.writeByte(METADATA_PARTICLE); - packet.writeVarInt(particle.getId()); - particleDataConsumer.accept(packet); - } - }*/ - - @Override - public int getObjectData() { - return 0; - } - - public float getRadius() { - return radius; - } - - public void setRadius(float radius) { - this.radius = radius; - setBoundingBox(2 * radius, 0.5f, 2 * radius); - //sendMetadataIndex(7); - } - - public int getColor() { - return color; - } - - public void setColor(int color) { - this.color = color; - //sendMetadataIndex(8); - } - - public boolean isIgnoreRadius() { - return ignoreRadius; - } - - public void setIgnoreRadius(boolean ignoreRadius) { - this.ignoreRadius = ignoreRadius; - //sendMetadataIndex(9); - } - - public Particle getParticle() { - return particleType; - } - - public void setParticle(Particle particleType) { - this.particleType = particleType; - //sendMetadataIndex(10); - } - - public Consumer getParticleDataConsumer() { - return particleDataConsumer; - } - - /** - * Used to add data to the particle - * - * @param particleDataConsumer the particle data consumer - * @see Particle data - */ - public void setParticleDataConsumer(Consumer particleDataConsumer) { - this.particleDataConsumer = 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 deleted file mode 100644 index e1a205a66..000000000 --- a/src/main/java/net/minestom/server/entity/type/other/EntityEndCrystal.java +++ /dev/null @@ -1,44 +0,0 @@ -package net.minestom.server.entity.type.other; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.entity.ObjectEntity; -import net.minestom.server.utils.BlockPosition; -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) { - super(EntityType.END_CRYSTAL, spawnPosition); - - setBoundingBox(2f, 2f, 2f); - } - - @Nullable - public BlockPosition getBeamTarget() { - return metadata.getIndex((byte) 7, null); - } - - public void setBeamTarget(@Nullable BlockPosition beamTarget) { - this.metadata.setIndex((byte) 7, Metadata.OptPosition(beamTarget)); - } - - public boolean showBottom() { - return metadata.getIndex((byte) 8, true); - } - - public void setShowBottom(boolean showBottom) { - this.metadata.setIndex((byte) 8, Metadata.Boolean(showBottom)); - } - - @Override - public int getObjectData() { - return 0; - } -} 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 deleted file mode 100644 index 97b5582be..000000000 --- a/src/main/java/net/minestom/server/entity/type/other/EntityIronGolem.java +++ /dev/null @@ -1,27 +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.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) { - super(EntityType.IRON_GOLEM, spawnPosition); - setBoundingBox(1.4f, 2.7f, 1.4f); - } - - public boolean isPlayerCreated() { - return metadata.getIndex((byte) 15, 0) == 0x01; - } - - public void setPlayerCreated(boolean playerCreated) { - this.metadata.setIndex((byte) 15, Metadata.Byte((byte) (playerCreated ? 0x01 : 0x00))); - } -} 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 deleted file mode 100644 index 5726ce421..000000000 --- a/src/main/java/net/minestom/server/entity/type/other/EntitySnowman.java +++ /dev/null @@ -1,27 +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.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) { - super(EntityType.SNOW_GOLEM, spawnPosition); - setBoundingBox(0.7f, 1.9f, 0.7f); - } - - public boolean hasPumpkinHat() { - return metadata.getIndex((byte) 15, (byte) 0x00) == 0x10; - } - - public void setPumpkinHat(boolean pumpkinHat) { - this.metadata.setIndex((byte) 15, Metadata.Byte((byte) (pumpkinHat ? 0x10 : 0x00))); - } -} 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 deleted file mode 100644 index 4ebfa357d..000000000 --- a/src/main/java/net/minestom/server/entity/type/projectile/EntityEyeOfEnder.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.minestom.server.entity.type.projectile; - -import net.minestom.server.entity.Entity; -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.item.ItemStack; -import net.minestom.server.item.Material; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * @deprecated Use {@link net.minestom.server.entity.metadata.item.EyeOfEnderMeta} instead. - */ -@Deprecated -public class EntityEyeOfEnder extends Entity { - - public EntityEyeOfEnder(@Nullable Entity shooter, @NotNull Position spawnPosition) { - super(EntityType.EYE_OF_ENDER, spawnPosition); - } - - - /** - * Gets the eye of ender item. - * - * @return the item - */ - public ItemStack getItemStack() { - return metadata.getIndex((byte) 7, ItemStack.AIR); - } - - /** - * Changes the eye of ender item. - *

- * Can be null to make it like {@link Material#ENDER_EYE}. - * - * @param itemStack the new item stack - */ - public void setItemStack(ItemStack itemStack) { - this.metadata.setIndex((byte) 7, Metadata.Slot(itemStack)); - } - -} 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 deleted file mode 100644 index f0c1e1c76..000000000 --- a/src/main/java/net/minestom/server/entity/type/projectile/EntityPotion.java +++ /dev/null @@ -1,31 +0,0 @@ -package net.minestom.server.entity.type.projectile; - -import net.minestom.server.entity.Entity; -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.item.ItemStack; -import net.minestom.server.utils.Position; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * @deprecated Use {@link net.minestom.server.entity.metadata.item.ThrownPotionMeta} instead. - */ -@Deprecated -public class EntityPotion extends Entity { - - public EntityPotion(@Nullable Entity shooter, @NotNull Position spawnPosition, @NotNull ItemStack potion) { - super(EntityType.POTION, spawnPosition); - setBoundingBox(0.25f, 0.25f, 0.25f); - setPotion(potion); - } - - @NotNull - public ItemStack getPotion() { - return metadata.getIndex((byte) 7, ItemStack.AIR); - } - - public void setPotion(@NotNull ItemStack potion) { - this.metadata.setIndex((byte) 7, Metadata.Slot(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 deleted file mode 100644 index 5590a0f96..000000000 --- a/src/main/java/net/minestom/server/entity/type/vehicle/EntityBoat.java +++ /dev/null @@ -1,57 +0,0 @@ -package net.minestom.server.entity.type.vehicle; - -import net.minestom.server.entity.EntityType; -import net.minestom.server.entity.Metadata; -import net.minestom.server.entity.ObjectEntity; -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) { - super(EntityType.BOAT, spawnPosition); - setBoundingBox(1.375f, 0.5625f, 1.375f); - } - - @Override - public int getObjectData() { - return 0; - } - - /** - * Gets the boat type. - * - * @return the boat type - */ - @NotNull - public BoatType getBoatType() { - final int ordinal = metadata.getIndex((byte) 10, 0); - return BoatType.values()[ordinal]; - } - - /** - * Changes the boat type. - * - * @param boatType the new boat type - */ - public void setBoatType(@NotNull BoatType boatType) { - this.metadata.setIndex((byte) 10, Metadata.VarInt(boatType.ordinal())); - - } - - public void refreshPaddle(boolean left, boolean right) { - this.metadata.setIndex((byte) 11, Metadata.Boolean(left)); - this.metadata.setIndex((byte) 12, Metadata.Boolean(right)); - } - - public enum BoatType { - OAK, SPRUCE, BIRCH, JUNGLE, ACACIA, DARK_OAK - } - - -} diff --git a/src/main/java/net/minestom/server/event/entity/EntityShootEvent.java b/src/main/java/net/minestom/server/event/entity/EntityShootEvent.java index 034b64a88..88c02f14e 100644 --- a/src/main/java/net/minestom/server/event/entity/EntityShootEvent.java +++ b/src/main/java/net/minestom/server/event/entity/EntityShootEvent.java @@ -1,13 +1,14 @@ package net.minestom.server.event.entity; import net.minestom.server.entity.Entity; +import net.minestom.server.entity.EntityProjectile; import net.minestom.server.event.trait.CancellableEvent; import net.minestom.server.event.trait.EntityEvent; import net.minestom.server.utils.Position; import org.jetbrains.annotations.NotNull; /** - * Called with {@link net.minestom.server.entity.type.projectile.EntityProjectile#shoot(Position, double, double)} + * Called with {@link EntityProjectile#shoot(Position, double, double)} */ public class EntityShootEvent implements EntityEvent, CancellableEvent { diff --git a/src/test/java/demo/commands/ShootCommand.java b/src/test/java/demo/commands/ShootCommand.java index 3968a5e16..3d8cbd17b 100644 --- a/src/test/java/demo/commands/ShootCommand.java +++ b/src/test/java/demo/commands/ShootCommand.java @@ -10,7 +10,7 @@ import net.minestom.server.command.builder.exception.ArgumentSyntaxException; import net.minestom.server.entity.EntityType; import net.minestom.server.entity.Player; import net.minestom.server.entity.metadata.arrow.ArrowMeta; -import net.minestom.server.entity.type.projectile.EntityProjectile; +import net.minestom.server.entity.EntityProjectile; import java.util.concurrent.ThreadLocalRandom;