mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-03 15:08:29 +01:00
Removed new entity classes and marked previously existing ones as deprecated
This commit is contained in:
parent
bc591b0a7e
commit
237466c90e
@ -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;
|
||||
|
||||
|
@ -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()));
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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(),
|
||||
|
@ -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 {
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
@ -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)));
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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) {
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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) {
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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) {
|
||||
|
@ -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
|
||||
));
|
||||
}
|
||||
|
||||
}
|
@ -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) {
|
||||
|
@ -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<BinaryWriter> particleDataConsumer;
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
@ -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) {
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user