mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-04 23:47:59 +01:00
Refactor and remove classes
This commit is contained in:
parent
6173301a4b
commit
9e23085c34
@ -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;
|
@ -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 <a href="https://wiki.vg/Object_Data">here</a>
|
||||
*/
|
||||
public abstract int getObjectData();
|
||||
|
||||
@Override
|
||||
public void update(long time) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawn() {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
package net.minestom.server.entity.type;
|
||||
|
||||
public interface Ageable {
|
||||
|
||||
boolean isBaby();
|
||||
|
||||
void setBaby(boolean value);
|
||||
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
package net.minestom.server.entity.type;
|
||||
|
||||
public interface Animal extends Ageable {
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
package net.minestom.server.entity.type;
|
||||
|
||||
public interface Constructable {
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
package net.minestom.server.entity.type;
|
||||
|
||||
public interface Monster {
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
package net.minestom.server.entity.type;
|
||||
|
||||
public interface TameableAnimal extends Animal {
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
package net.minestom.server.entity.type;
|
||||
|
||||
public interface Vehicle {
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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));
|
||||
}
|
||||
}
|
@ -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));
|
||||
}
|
||||
}
|
@ -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));
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
||||
|
||||
}
|
@ -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)));
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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));
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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()));
|
||||
}
|
||||
}
|
@ -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));
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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));
|
||||
}
|
||||
}
|
@ -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));
|
||||
}
|
||||
}
|
@ -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));
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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<BinaryWriter> 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<BinaryWriter> 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<BinaryWriter> getParticleDataConsumer() {
|
||||
return particleDataConsumer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to add data to the particle
|
||||
*
|
||||
* @param particleDataConsumer the particle data consumer
|
||||
* @see <a href="https://wiki.vg/Data_types#Particle">Particle data</a>
|
||||
*/
|
||||
public void setParticleDataConsumer(Consumer<BinaryWriter> particleDataConsumer) {
|
||||
this.particleDataConsumer = particleDataConsumer;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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)));
|
||||
}
|
||||
}
|
@ -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)));
|
||||
}
|
||||
}
|
@ -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.
|
||||
* <p>
|
||||
* 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));
|
||||
}
|
||||
|
||||
}
|
@ -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));
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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 {
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user