mirror of
https://github.com/Minestom/Minestom.git
synced 2025-03-02 11:21:15 +01:00
update existing metadata to 1.17, using new system
This commit is contained in:
parent
1065ad346e
commit
1850efb3fc
@ -238,20 +238,20 @@ public class Metadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T> T getIndex(byte index, @Nullable T defaultValue) {
|
public <T> T getIndex(int index, @Nullable T defaultValue) {
|
||||||
Entry<?> value = this.metadataMap.get(index);
|
Entry<?> value = this.metadataMap.get((byte) index);
|
||||||
return value != null ? (T) value.getMetaValue().value : defaultValue;
|
return value != null ? (T) value.getMetaValue().value : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIndex(byte index, @NotNull Value<?> value) {
|
public void setIndex(int index, @NotNull Value<?> value) {
|
||||||
final Entry<?> entry = new Entry<>(index, value);
|
final Entry<?> entry = new Entry<>((byte) index, value);
|
||||||
this.metadataMap.put(index, entry);
|
this.metadataMap.put((byte) index, entry);
|
||||||
|
|
||||||
// Send metadata packet to update viewers and self
|
// Send metadata packet to update viewers and self
|
||||||
if (this.entity != null && this.entity.isActive()) {
|
if (this.entity != null && this.entity.isActive()) {
|
||||||
if (!this.notifyAboutChanges) {
|
if (!this.notifyAboutChanges) {
|
||||||
synchronized (this.notNotifiedChanges) {
|
synchronized (this.notNotifiedChanges) {
|
||||||
this.notNotifiedChanges.put(index, entry);
|
this.notNotifiedChanges.put((byte) index, entry);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -6,13 +6,15 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class AgeableMobMeta extends PathfinderMobMeta {
|
public class AgeableMobMeta extends PathfinderMobMeta {
|
||||||
|
public static final byte OFFSET = PathfinderMobMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
protected AgeableMobMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
protected AgeableMobMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBaby() {
|
public boolean isBaby() {
|
||||||
return super.metadata.getIndex((byte) 15, false);
|
return super.metadata.getIndex(OFFSET, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBaby(boolean value) {
|
public void setBaby(boolean value) {
|
||||||
@ -25,7 +27,7 @@ public class AgeableMobMeta extends PathfinderMobMeta {
|
|||||||
} else {
|
} else {
|
||||||
setBoundingBox(bb.getWidth() * 2, bb.getHeight() * 2);
|
setBoundingBox(bb.getWidth() * 2, bb.getHeight() * 2);
|
||||||
}
|
}
|
||||||
super.metadata.setIndex((byte) 15, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class EntityMeta {
|
public class EntityMeta {
|
||||||
|
public static final byte OFFSET = 0;
|
||||||
private final static byte MASK_INDEX = 0;
|
public static final byte MAX_OFFSET = OFFSET + 8;
|
||||||
|
|
||||||
private final static byte ON_FIRE_BIT = 0x01;
|
private final static byte ON_FIRE_BIT = 0x01;
|
||||||
private final static byte CROUNCHING_BIT = 0x02;
|
private final static byte CROUNCHING_BIT = 0x02;
|
||||||
@ -44,67 +44,67 @@ public class EntityMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOnFire() {
|
public boolean isOnFire() {
|
||||||
return getMaskBit(MASK_INDEX, ON_FIRE_BIT);
|
return getMaskBit(OFFSET, ON_FIRE_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnFire(boolean value) {
|
public void setOnFire(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, ON_FIRE_BIT, value);
|
setMaskBit(OFFSET, ON_FIRE_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSneaking() {
|
public boolean isSneaking() {
|
||||||
return getMaskBit(MASK_INDEX, CROUNCHING_BIT);
|
return getMaskBit(OFFSET, CROUNCHING_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSneaking(boolean value) {
|
public void setSneaking(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, CROUNCHING_BIT, value);
|
setMaskBit(OFFSET, CROUNCHING_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSprinting() {
|
public boolean isSprinting() {
|
||||||
return getMaskBit(MASK_INDEX, SPRINTING_BIT);
|
return getMaskBit(OFFSET, SPRINTING_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSprinting(boolean value) {
|
public void setSprinting(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, SPRINTING_BIT, value);
|
setMaskBit(OFFSET, SPRINTING_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSwimming() {
|
public boolean isSwimming() {
|
||||||
return getMaskBit(MASK_INDEX, SWIMMING_BIT);
|
return getMaskBit(OFFSET, SWIMMING_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSwimming(boolean value) {
|
public void setSwimming(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, SWIMMING_BIT, value);
|
setMaskBit(OFFSET, SWIMMING_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInvisible() {
|
public boolean isInvisible() {
|
||||||
return getMaskBit(MASK_INDEX, INVISIBLE_BIT);
|
return getMaskBit(OFFSET, INVISIBLE_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInvisible(boolean value) {
|
public void setInvisible(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, INVISIBLE_BIT, value);
|
setMaskBit(OFFSET, INVISIBLE_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHasGlowingEffect() {
|
public boolean isHasGlowingEffect() {
|
||||||
return getMaskBit(MASK_INDEX, HAS_GLOWING_EFFECT_BIT);
|
return getMaskBit(OFFSET, HAS_GLOWING_EFFECT_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHasGlowingEffect(boolean value) {
|
public void setHasGlowingEffect(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, HAS_GLOWING_EFFECT_BIT, value);
|
setMaskBit(OFFSET, HAS_GLOWING_EFFECT_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFlyingWithElytra() {
|
public boolean isFlyingWithElytra() {
|
||||||
return getMaskBit(MASK_INDEX, FLYING_WITH_ELYTRA_BIT);
|
return getMaskBit(OFFSET, FLYING_WITH_ELYTRA_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFlyingWithElytra(boolean value) {
|
public void setFlyingWithElytra(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, FLYING_WITH_ELYTRA_BIT, value);
|
setMaskBit(OFFSET, FLYING_WITH_ELYTRA_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAirTicks() {
|
public int getAirTicks() {
|
||||||
return this.metadata.getIndex((byte) 1, 300);
|
return this.metadata.getIndex(OFFSET + 1, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAirTicks(int value) {
|
public void setAirTicks(int value) {
|
||||||
this.metadata.setIndex((byte) 1, Metadata.VarInt(value));
|
this.metadata.setIndex(OFFSET + 1, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -126,66 +126,66 @@ public class EntityMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Component getCustomName() {
|
public Component getCustomName() {
|
||||||
return this.metadata.getIndex((byte) 2, null);
|
return this.metadata.getIndex(OFFSET + 2, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCustomName(Component value) {
|
public void setCustomName(Component value) {
|
||||||
this.metadata.setIndex((byte) 2, Metadata.OptChat(value));
|
this.metadata.setIndex(OFFSET + 2, Metadata.OptChat(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCustomNameVisible() {
|
public boolean isCustomNameVisible() {
|
||||||
return this.metadata.getIndex((byte) 3, false);
|
return this.metadata.getIndex(OFFSET + 3, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCustomNameVisible(boolean value) {
|
public void setCustomNameVisible(boolean value) {
|
||||||
this.metadata.setIndex((byte) 3, Metadata.Boolean(value));
|
this.metadata.setIndex(OFFSET + 3, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSilent() {
|
public boolean isSilent() {
|
||||||
return this.metadata.getIndex((byte) 4, false);
|
return this.metadata.getIndex(OFFSET + 4, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSilent(boolean value) {
|
public void setSilent(boolean value) {
|
||||||
this.metadata.setIndex((byte) 4, Metadata.Boolean(value));
|
this.metadata.setIndex(OFFSET + 4, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHasNoGravity() {
|
public boolean isHasNoGravity() {
|
||||||
return this.metadata.getIndex((byte) 5, false);
|
return this.metadata.getIndex(OFFSET + 5, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHasNoGravity(boolean value) {
|
public void setHasNoGravity(boolean value) {
|
||||||
this.metadata.setIndex((byte) 5, Metadata.Boolean(value));
|
this.metadata.setIndex(OFFSET + 5, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Entity.Pose getPose() {
|
public Entity.Pose getPose() {
|
||||||
return this.metadata.getIndex((byte) 6, Entity.Pose.STANDING);
|
return this.metadata.getIndex(OFFSET + 6, Entity.Pose.STANDING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPose(Entity.Pose value) {
|
public void setPose(Entity.Pose value) {
|
||||||
this.metadata.setIndex((byte) 6, Metadata.Pose(value));
|
this.metadata.setIndex(OFFSET + 6, Metadata.Pose(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTickFrozen() {
|
public int getTickFrozen() {
|
||||||
return this.metadata.getIndex((byte) 7, 0);
|
return this.metadata.getIndex(OFFSET + 7, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTickFrozen(int tickFrozen) {
|
public void setTickFrozen(int tickFrozen) {
|
||||||
this.metadata.setIndex((byte) 7, Metadata.VarInt(tickFrozen));
|
this.metadata.setIndex(OFFSET + 7, Metadata.VarInt(tickFrozen));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected byte getMask(byte index) {
|
protected byte getMask(int index) {
|
||||||
return this.metadata.getIndex(index, (byte) 0);
|
return this.metadata.getIndex(index, (byte) 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setMask(byte index, byte mask) {
|
protected void setMask(int index, byte mask) {
|
||||||
this.metadata.setIndex(index, Metadata.Byte(mask));
|
this.metadata.setIndex(index, Metadata.Byte(mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean getMaskBit(byte index, byte bit) {
|
protected boolean getMaskBit(int index, byte bit) {
|
||||||
return (getMask(index) & bit) == bit;
|
return (getMask(index) & bit) == bit;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setMaskBit(byte index, byte bit, boolean value) {
|
protected void setMaskBit(int index, byte bit, boolean value) {
|
||||||
byte mask = getMask(index);
|
byte mask = getMask(index);
|
||||||
boolean currentValue = (mask & bit) == bit;
|
boolean currentValue = (mask & bit) == bit;
|
||||||
if (currentValue == value) {
|
if (currentValue == value) {
|
||||||
|
@ -8,8 +8,8 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class LivingEntityMeta extends EntityMeta {
|
public class LivingEntityMeta extends EntityMeta {
|
||||||
|
public static final byte OFFSET = EntityMeta.MAX_OFFSET;
|
||||||
private final static byte MASK_INDEX = 7;
|
public static final byte MAX_OFFSET = OFFSET + 7;
|
||||||
|
|
||||||
private final static byte IS_HAND_ACTIVE_BIT = 0x01;
|
private final static byte IS_HAND_ACTIVE_BIT = 0x01;
|
||||||
private final static byte ACTIVE_HAND_BIT = 0x02;
|
private final static byte ACTIVE_HAND_BIT = 0x02;
|
||||||
@ -20,77 +20,77 @@ public class LivingEntityMeta extends EntityMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHandActive() {
|
public boolean isHandActive() {
|
||||||
return getMaskBit(MASK_INDEX, IS_HAND_ACTIVE_BIT);
|
return getMaskBit(OFFSET, IS_HAND_ACTIVE_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHandActive(boolean value) {
|
public void setHandActive(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, IS_HAND_ACTIVE_BIT, value);
|
setMaskBit(OFFSET, IS_HAND_ACTIVE_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public Player.Hand getActiveHand() {
|
public Player.Hand getActiveHand() {
|
||||||
return getMaskBit(MASK_INDEX, ACTIVE_HAND_BIT) ? Player.Hand.OFF : Player.Hand.MAIN;
|
return getMaskBit(OFFSET, ACTIVE_HAND_BIT) ? Player.Hand.OFF : Player.Hand.MAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActiveHand(@NotNull Player.Hand hand) {
|
public void setActiveHand(@NotNull Player.Hand hand) {
|
||||||
setMaskBit(MASK_INDEX, ACTIVE_HAND_BIT, hand == Player.Hand.OFF);
|
setMaskBit(OFFSET, ACTIVE_HAND_BIT, hand == Player.Hand.OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInRiptideSpinAttack() {
|
public boolean isInRiptideSpinAttack() {
|
||||||
return getMaskBit(MASK_INDEX, IS_IN_SPIN_ATTACK_BIT);
|
return getMaskBit(OFFSET, IS_IN_SPIN_ATTACK_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInRiptideSpinAttack(boolean value) {
|
public void setInRiptideSpinAttack(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, IS_IN_SPIN_ATTACK_BIT, value);
|
setMaskBit(OFFSET, IS_IN_SPIN_ATTACK_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getHealth() {
|
public float getHealth() {
|
||||||
return super.metadata.getIndex((byte) 8, 1F);
|
return super.metadata.getIndex(OFFSET + 1, 1F);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHealth(float value) {
|
public void setHealth(float value) {
|
||||||
super.metadata.setIndex((byte) 8, Metadata.Float(value));
|
super.metadata.setIndex(OFFSET + 1, Metadata.Float(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPotionEffectColor() {
|
public int getPotionEffectColor() {
|
||||||
return super.metadata.getIndex((byte) 9, 0);
|
return super.metadata.getIndex(OFFSET + 2, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPotionEffectColor(int value) {
|
public void setPotionEffectColor(int value) {
|
||||||
super.metadata.setIndex((byte) 9, Metadata.VarInt(value));
|
super.metadata.setIndex(OFFSET + 2, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPotionEffectAmbient() {
|
public boolean isPotionEffectAmbient() {
|
||||||
return super.metadata.getIndex((byte) 10, false);
|
return super.metadata.getIndex(OFFSET + 3, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPotionEffectAmbient(boolean value) {
|
public void setPotionEffectAmbient(boolean value) {
|
||||||
super.metadata.setIndex((byte) 10, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET + 3, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getArrowCount() {
|
public int getArrowCount() {
|
||||||
return super.metadata.getIndex((byte) 11, 0);
|
return super.metadata.getIndex(OFFSET + 4, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setArrowCount(int value) {
|
public void setArrowCount(int value) {
|
||||||
super.metadata.getIndex((byte) 11, Metadata.VarInt(value));
|
super.metadata.getIndex(OFFSET + 4, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHealthAddedByAbsorption() {
|
public int getHealthAddedByAbsorption() {
|
||||||
return super.metadata.getIndex((byte) 12, 0);
|
return super.metadata.getIndex(OFFSET + 5, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHealthAddedByAbsorption(int value) {
|
public void setHealthAddedByAbsorption(int value) {
|
||||||
super.metadata.getIndex((byte) 12, Metadata.VarInt(value));
|
super.metadata.getIndex(OFFSET + 5, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public BlockPosition getBedInWhichSleepingPosition() {
|
public BlockPosition getBedInWhichSleepingPosition() {
|
||||||
return super.metadata.getIndex((byte) 13, null);
|
return super.metadata.getIndex(OFFSET + 6, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBedInWhichSleepingPosition(@Nullable BlockPosition value) {
|
public void setBedInWhichSleepingPosition(@Nullable BlockPosition value) {
|
||||||
super.metadata.setIndex((byte) 13, Metadata.OptPosition(value));
|
super.metadata.setIndex(OFFSET + 6, Metadata.OptPosition(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class MobMeta extends LivingEntityMeta {
|
public class MobMeta extends LivingEntityMeta {
|
||||||
|
public static final byte OFFSET = LivingEntityMeta.MAX_OFFSET;
|
||||||
private final static byte MASK_INDEX = 14;
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
private final static byte NO_AI_BIT = 0x01;
|
private final static byte NO_AI_BIT = 0x01;
|
||||||
private final static byte IS_LEFT_HANDED_BIT = 0x02;
|
private final static byte IS_LEFT_HANDED_BIT = 0x02;
|
||||||
@ -17,27 +17,27 @@ public class MobMeta extends LivingEntityMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNoAi() {
|
public boolean isNoAi() {
|
||||||
return getMaskBit(MASK_INDEX, NO_AI_BIT);
|
return getMaskBit(OFFSET, NO_AI_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNoAi(boolean value) {
|
public void setNoAi(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, NO_AI_BIT, value);
|
setMaskBit(OFFSET, NO_AI_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLeftHanded() {
|
public boolean isLeftHanded() {
|
||||||
return getMaskBit(MASK_INDEX, IS_LEFT_HANDED_BIT);
|
return getMaskBit(OFFSET, IS_LEFT_HANDED_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLeftHanded(boolean value) {
|
public void setLeftHanded(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, IS_LEFT_HANDED_BIT, value);
|
setMaskBit(OFFSET, IS_LEFT_HANDED_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAggressive() {
|
public boolean isAggressive() {
|
||||||
return getMaskBit(MASK_INDEX, IS_AGGRESSIVE_BIT);
|
return getMaskBit(OFFSET, IS_AGGRESSIVE_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAggressive(boolean value) {
|
public void setAggressive(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, IS_AGGRESSIVE_BIT, value);
|
setMaskBit(OFFSET, IS_AGGRESSIVE_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class PathfinderMobMeta extends MobMeta {
|
public class PathfinderMobMeta extends MobMeta {
|
||||||
|
public static final byte OFFSET = MobMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
protected PathfinderMobMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
protected PathfinderMobMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -7,8 +7,8 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
import org.jglrxavpok.hephaistos.nbt.NBT;
|
import org.jglrxavpok.hephaistos.nbt.NBT;
|
||||||
|
|
||||||
public class PlayerMeta extends LivingEntityMeta {
|
public class PlayerMeta extends LivingEntityMeta {
|
||||||
|
public static final byte OFFSET = LivingEntityMeta.MAX_OFFSET;
|
||||||
private final static byte MASK_INDEX = 16;
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
private final static byte CAPE_BIT = 0x01;
|
private final static byte CAPE_BIT = 0x01;
|
||||||
private final static byte JACKET_BIT = 0x02;
|
private final static byte JACKET_BIT = 0x02;
|
||||||
@ -23,101 +23,101 @@ public class PlayerMeta extends LivingEntityMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public float getAdditionalHearts() {
|
public float getAdditionalHearts() {
|
||||||
return super.metadata.getIndex((byte) 14, 0F);
|
return super.metadata.getIndex(OFFSET, 0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAdditionalHearts(float value) {
|
public void setAdditionalHearts(float value) {
|
||||||
super.metadata.setIndex((byte) 14, Metadata.Float(value));
|
super.metadata.setIndex(OFFSET, Metadata.Float(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getScore() {
|
public int getScore() {
|
||||||
return super.metadata.getIndex((byte) 15, 0);
|
return super.metadata.getIndex(OFFSET + 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setScore(int value) {
|
public void setScore(int value) {
|
||||||
super.metadata.setIndex((byte) 15, Metadata.VarInt(value));
|
super.metadata.setIndex(OFFSET + 1, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCapeEnabled() {
|
public boolean isCapeEnabled() {
|
||||||
return getMaskBit(MASK_INDEX, CAPE_BIT);
|
return getMaskBit(OFFSET + 2, CAPE_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCapeEnabled(boolean value) {
|
public void setCapeEnabled(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, CAPE_BIT, value);
|
setMaskBit(OFFSET + 2, CAPE_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isJacketEnabled() {
|
public boolean isJacketEnabled() {
|
||||||
return getMaskBit(MASK_INDEX, JACKET_BIT);
|
return getMaskBit(OFFSET + 2, JACKET_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setJacketEnabled(boolean value) {
|
public void setJacketEnabled(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, JACKET_BIT, value);
|
setMaskBit(OFFSET + 2, JACKET_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLeftSleeveEnabled() {
|
public boolean isLeftSleeveEnabled() {
|
||||||
return getMaskBit(MASK_INDEX, LEFT_SLEEVE_BIT);
|
return getMaskBit(OFFSET + 2, LEFT_SLEEVE_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLeftSleeveEnabled(boolean value) {
|
public void setLeftSleeveEnabled(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, LEFT_SLEEVE_BIT, value);
|
setMaskBit(OFFSET + 2, LEFT_SLEEVE_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRightSleeveEnabled() {
|
public boolean isRightSleeveEnabled() {
|
||||||
return getMaskBit(MASK_INDEX, RIGHT_SLEEVE_BIT);
|
return getMaskBit(OFFSET + 2, RIGHT_SLEEVE_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRightSleeveEnabled(boolean value) {
|
public void setRightSleeveEnabled(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, RIGHT_SLEEVE_BIT, value);
|
setMaskBit(OFFSET + 2, RIGHT_SLEEVE_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLeftLegEnabled() {
|
public boolean isLeftLegEnabled() {
|
||||||
return getMaskBit(MASK_INDEX, LEFT_LEG_BIT);
|
return getMaskBit(OFFSET + 2, LEFT_LEG_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLeftLegEnabled(boolean value) {
|
public void setLeftLegEnabled(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, LEFT_LEG_BIT, value);
|
setMaskBit(OFFSET + 2, LEFT_LEG_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRightLegEnabled() {
|
public boolean isRightLegEnabled() {
|
||||||
return getMaskBit(MASK_INDEX, RIGHT_LEG_BIT);
|
return getMaskBit(OFFSET + 2, RIGHT_LEG_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRightLegEnabled(boolean value) {
|
public void setRightLegEnabled(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, RIGHT_LEG_BIT, value);
|
setMaskBit(OFFSET + 2, RIGHT_LEG_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHatEnabled() {
|
public boolean isHatEnabled() {
|
||||||
return getMaskBit(MASK_INDEX, HAT_BIT);
|
return getMaskBit(OFFSET + 2, HAT_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHatEnabled(boolean value) {
|
public void setHatEnabled(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, HAT_BIT, value);
|
setMaskBit(OFFSET + 2, HAT_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRightMainHand() {
|
public boolean isRightMainHand() {
|
||||||
return super.metadata.getIndex((byte) 17, (byte) 1) == (byte) 1;
|
return super.metadata.getIndex(OFFSET + 3, (byte) 1) == (byte) 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRightMainHand(boolean value) {
|
public void setRightMainHand(boolean value) {
|
||||||
super.metadata.setIndex((byte) 17, Metadata.Byte(value ? (byte) 1 : (byte) 0));
|
super.metadata.setIndex(OFFSET + 3, Metadata.Byte(value ? (byte) 1 : (byte) 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public NBT getLeftShoulderEntityData() {
|
public NBT getLeftShoulderEntityData() {
|
||||||
return super.metadata.getIndex((byte) 18, null);
|
return super.metadata.getIndex(OFFSET + 4, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLeftShoulderEntityData(@Nullable NBT value) {
|
public void setLeftShoulderEntityData(@Nullable NBT value) {
|
||||||
super.metadata.setIndex((byte) 18, Metadata.NBT(value));
|
super.metadata.setIndex(OFFSET + 4, Metadata.NBT(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public NBT getRightShoulderEntityData() {
|
public NBT getRightShoulderEntityData() {
|
||||||
return super.metadata.getIndex((byte) 19, null);
|
return super.metadata.getIndex(OFFSET + 5, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRightShoulderEntityData(@Nullable NBT value) {
|
public void setRightShoulderEntityData(@Nullable NBT value) {
|
||||||
super.metadata.setIndex((byte) 19, Metadata.NBT(value));
|
super.metadata.setIndex(OFFSET + 5, Metadata.NBT(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,13 @@ package net.minestom.server.entity.metadata.ambient;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.LivingEntityMeta;
|
||||||
import net.minestom.server.entity.metadata.MobMeta;
|
import net.minestom.server.entity.metadata.MobMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class AmbientCreatureMeta extends MobMeta {
|
public class AmbientCreatureMeta extends MobMeta {
|
||||||
|
public static final byte OFFSET = MobMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
protected AmbientCreatureMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
protected AmbientCreatureMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -2,11 +2,12 @@ package net.minestom.server.entity.metadata.ambient;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.LivingEntityMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class BatMeta extends AmbientCreatureMeta {
|
public class BatMeta extends AmbientCreatureMeta {
|
||||||
|
public static final byte OFFSET = AmbientCreatureMeta.MAX_OFFSET;
|
||||||
private final static byte MASK_INDEX = 15;
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
private final static byte IS_HANGING_BIT = 0x01;
|
private final static byte IS_HANGING_BIT = 0x01;
|
||||||
|
|
||||||
@ -15,11 +16,11 @@ public class BatMeta extends AmbientCreatureMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHanging() {
|
public boolean isHanging() {
|
||||||
return getMaskBit(MASK_INDEX, IS_HANGING_BIT);
|
return getMaskBit(OFFSET, IS_HANGING_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHanging(boolean value) {
|
public void setHanging(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, IS_HANGING_BIT, value);
|
setMaskBit(OFFSET, IS_HANGING_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,14 @@ package net.minestom.server.entity.metadata.animal;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.LivingEntityMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class AbstractHorseMeta extends AnimalMeta {
|
public class AbstractHorseMeta extends AnimalMeta {
|
||||||
|
public static final byte OFFSET = AnimalMeta.MAX_OFFSET;
|
||||||
private final static byte MASK_INDEX = 16;
|
public static final byte MAX_OFFSET = OFFSET + 2;
|
||||||
|
|
||||||
private final static byte TAMED_BIT = 0x02;
|
private final static byte TAMED_BIT = 0x02;
|
||||||
private final static byte SADDLED_BIT = 0x04;
|
private final static byte SADDLED_BIT = 0x04;
|
||||||
@ -22,59 +23,59 @@ public class AbstractHorseMeta extends AnimalMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTamed() {
|
public boolean isTamed() {
|
||||||
return getMaskBit(MASK_INDEX, TAMED_BIT);
|
return getMaskBit(OFFSET, TAMED_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTamed(boolean value) {
|
public void setTamed(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, TAMED_BIT, value);
|
setMaskBit(OFFSET, TAMED_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSaddled() {
|
public boolean isSaddled() {
|
||||||
return getMaskBit(MASK_INDEX, SADDLED_BIT);
|
return getMaskBit(OFFSET, SADDLED_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSaddled(boolean value) {
|
public void setSaddled(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, SADDLED_BIT, value);
|
setMaskBit(OFFSET, SADDLED_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHasBred() {
|
public boolean isHasBred() {
|
||||||
return getMaskBit(MASK_INDEX, HAS_BRED_BIT);
|
return getMaskBit(OFFSET, HAS_BRED_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHasBred(boolean value) {
|
public void setHasBred(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, HAS_BRED_BIT, value);
|
setMaskBit(OFFSET, HAS_BRED_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEating() {
|
public boolean isEating() {
|
||||||
return getMaskBit(MASK_INDEX, EATING_BIT);
|
return getMaskBit(OFFSET, EATING_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEating(boolean value) {
|
public void setEating(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, EATING_BIT, value);
|
setMaskBit(OFFSET, EATING_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRearing() {
|
public boolean isRearing() {
|
||||||
return getMaskBit(MASK_INDEX, REARING_BIT);
|
return getMaskBit(OFFSET, REARING_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRearing(boolean value) {
|
public void setRearing(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, REARING_BIT, value);
|
setMaskBit(OFFSET, REARING_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMouthOpen() {
|
public boolean isMouthOpen() {
|
||||||
return getMaskBit(MASK_INDEX, MOUTH_OPEN_BIT);
|
return getMaskBit(OFFSET, MOUTH_OPEN_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMouthOpen(boolean value) {
|
public void setMouthOpen(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, MOUTH_OPEN_BIT, value);
|
setMaskBit(OFFSET, MOUTH_OPEN_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getOwner() {
|
public UUID getOwner() {
|
||||||
return super.metadata.getIndex((byte) 17, null);
|
return super.metadata.getIndex(OFFSET + 1, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOwner(UUID value) {
|
public void setOwner(UUID value) {
|
||||||
super.metadata.setIndex((byte) 17, Metadata.OptUUID(value));
|
super.metadata.setIndex(OFFSET + 1, Metadata.OptUUID(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,12 @@ package net.minestom.server.entity.metadata.animal;
|
|||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
import net.minestom.server.entity.metadata.AgeableMobMeta;
|
import net.minestom.server.entity.metadata.AgeableMobMeta;
|
||||||
|
import net.minestom.server.entity.metadata.LivingEntityMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class AnimalMeta extends AgeableMobMeta {
|
public class AnimalMeta extends AgeableMobMeta {
|
||||||
|
public static final byte OFFSET = AgeableMobMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
protected AnimalMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
protected AnimalMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -2,11 +2,13 @@ package net.minestom.server.entity.metadata.animal;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.LivingEntityMeta;
|
||||||
|
import net.minestom.server.entity.metadata.ambient.AmbientCreatureMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class BeeMeta extends AnimalMeta {
|
public class BeeMeta extends AnimalMeta {
|
||||||
|
public static final byte OFFSET = AnimalMeta.MAX_OFFSET;
|
||||||
private final static byte MASK_INDEX = 16;
|
public static final byte MAX_OFFSET = OFFSET + 2;
|
||||||
|
|
||||||
private final static byte ANGRY_BIT = 0x02;
|
private final static byte ANGRY_BIT = 0x02;
|
||||||
private final static byte HAS_STUNG_BIT = 0x04;
|
private final static byte HAS_STUNG_BIT = 0x04;
|
||||||
@ -17,35 +19,35 @@ public class BeeMeta extends AnimalMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAngry() {
|
public boolean isAngry() {
|
||||||
return getMaskBit(MASK_INDEX, ANGRY_BIT);
|
return getMaskBit(OFFSET, ANGRY_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAngry(boolean value) {
|
public void setAngry(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, ANGRY_BIT, value);
|
setMaskBit(OFFSET, ANGRY_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHasStung() {
|
public boolean isHasStung() {
|
||||||
return getMaskBit(MASK_INDEX, HAS_STUNG_BIT);
|
return getMaskBit(OFFSET, HAS_STUNG_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHasStung(boolean value) {
|
public void setHasStung(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, HAS_STUNG_BIT, value);
|
setMaskBit(OFFSET, HAS_STUNG_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHasNectar() {
|
public boolean isHasNectar() {
|
||||||
return getMaskBit(MASK_INDEX, HAS_NECTAR_BIT);
|
return getMaskBit(OFFSET, HAS_NECTAR_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHasNectar(boolean value) {
|
public void setHasNectar(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, HAS_NECTAR_BIT, value);
|
setMaskBit(OFFSET, HAS_NECTAR_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAngerTicks() {
|
public int getAngerTicks() {
|
||||||
return super.metadata.getIndex((byte) 17, 0);
|
return super.metadata.getIndex(OFFSET + 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAngerTicks(int value) {
|
public void setAngerTicks(int value) {
|
||||||
super.metadata.setIndex((byte) 17, Metadata.VarInt(value));
|
super.metadata.setIndex(OFFSET + 1, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,20 +2,23 @@ package net.minestom.server.entity.metadata.animal;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.LivingEntityMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class ChestedHorseMeta extends AbstractHorseMeta {
|
public class ChestedHorseMeta extends AbstractHorseMeta {
|
||||||
|
public static final byte OFFSET = AbstractHorseMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
protected ChestedHorseMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
protected ChestedHorseMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHasChest() {
|
public boolean isHasChest() {
|
||||||
return super.metadata.getIndex((byte) 18, false);
|
return super.metadata.getIndex(OFFSET, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHasChest(boolean value) {
|
public void setHasChest(boolean value) {
|
||||||
super.metadata.setIndex((byte) 18, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,12 @@ package net.minestom.server.entity.metadata.animal;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.LivingEntityMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class ChickenMeta extends AnimalMeta {
|
public class ChickenMeta extends AnimalMeta {
|
||||||
|
public static final byte OFFSET = AnimalMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public ChickenMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public ChickenMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -2,9 +2,12 @@ package net.minestom.server.entity.metadata.animal;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.LivingEntityMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class CowMeta extends AnimalMeta {
|
public class CowMeta extends AnimalMeta {
|
||||||
|
public static final byte OFFSET = AnimalMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public CowMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public CowMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -5,6 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class DonkeyMeta extends ChestedHorseMeta {
|
public class DonkeyMeta extends ChestedHorseMeta {
|
||||||
|
public static final byte OFFSET = AnimalMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public DonkeyMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public DonkeyMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -8,8 +8,8 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class FoxMeta extends AnimalMeta {
|
public class FoxMeta extends AnimalMeta {
|
||||||
|
public static final byte OFFSET = AnimalMeta.MAX_OFFSET;
|
||||||
private final static byte MASK_INDEX = 17;
|
public static final byte MAX_OFFSET = OFFSET + 4;
|
||||||
|
|
||||||
private final static byte SITTING_BIT = 0x01;
|
private final static byte SITTING_BIT = 0x01;
|
||||||
private final static byte CROUCHING_BIT = 0x04;
|
private final static byte CROUCHING_BIT = 0x04;
|
||||||
@ -25,85 +25,85 @@ public class FoxMeta extends AnimalMeta {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public Type getType() {
|
public Type getType() {
|
||||||
return Type.VALUES[super.metadata.getIndex((byte) 16, 0)];
|
return Type.VALUES[super.metadata.getIndex(OFFSET, 0)];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(@NotNull Type type) {
|
public void setType(@NotNull Type type) {
|
||||||
super.metadata.setIndex((byte) 16, Metadata.VarInt(type.ordinal()));
|
super.metadata.setIndex(OFFSET, Metadata.VarInt(type.ordinal()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSitting() {
|
public boolean isSitting() {
|
||||||
return getMaskBit(MASK_INDEX, SITTING_BIT);
|
return getMaskBit(OFFSET + 1, SITTING_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSitting(boolean value) {
|
public void setSitting(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, SITTING_BIT, value);
|
setMaskBit(OFFSET + 1, SITTING_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFoxSneaking() {
|
public boolean isFoxSneaking() {
|
||||||
return getMaskBit(MASK_INDEX, CROUCHING_BIT);
|
return getMaskBit(OFFSET + 1, CROUCHING_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFoxSneaking(boolean value) {
|
public void setFoxSneaking(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, CROUCHING_BIT, value);
|
setMaskBit(OFFSET + 1, CROUCHING_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInterested() {
|
public boolean isInterested() {
|
||||||
return getMaskBit(MASK_INDEX, INTERESTED_BIT);
|
return getMaskBit(OFFSET + 1, INTERESTED_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInterested(boolean value) {
|
public void setInterested(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, INTERESTED_BIT, value);
|
setMaskBit(OFFSET + 1, INTERESTED_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPouncing() {
|
public boolean isPouncing() {
|
||||||
return getMaskBit(MASK_INDEX, POUNCING_BIT);
|
return getMaskBit(OFFSET + 1, POUNCING_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPouncing(boolean value) {
|
public void setPouncing(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, POUNCING_BIT, value);
|
setMaskBit(OFFSET + 1, POUNCING_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSleeping() {
|
public boolean isSleeping() {
|
||||||
return getMaskBit(MASK_INDEX, SLEEPING_BIT);
|
return getMaskBit(OFFSET + 1, SLEEPING_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSleeping(boolean value) {
|
public void setSleeping(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, SLEEPING_BIT, value);
|
setMaskBit(OFFSET + 1, SLEEPING_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFaceplanted() {
|
public boolean isFaceplanted() {
|
||||||
return getMaskBit(MASK_INDEX, FACEPLANTED_BIT);
|
return getMaskBit(OFFSET + 1, FACEPLANTED_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFaceplanted(boolean value) {
|
public void setFaceplanted(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, FACEPLANTED_BIT, value);
|
setMaskBit(OFFSET + 1, FACEPLANTED_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDefending() {
|
public boolean isDefending() {
|
||||||
return getMaskBit(MASK_INDEX, DEFENDING_BIT);
|
return getMaskBit(OFFSET + 1, DEFENDING_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefending(boolean value) {
|
public void setDefending(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, DEFENDING_BIT, value);
|
setMaskBit(OFFSET + 1, DEFENDING_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public UUID getFirstUUID() {
|
public UUID getFirstUUID() {
|
||||||
return super.metadata.getIndex((byte) 18, null);
|
return super.metadata.getIndex(OFFSET + 2, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFirstUUID(@Nullable UUID value) {
|
public void setFirstUUID(@Nullable UUID value) {
|
||||||
super.metadata.setIndex((byte) 18, Metadata.OptUUID(value));
|
super.metadata.setIndex(OFFSET + 2, Metadata.OptUUID(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public UUID getSecondUUID() {
|
public UUID getSecondUUID() {
|
||||||
return super.metadata.getIndex((byte) 19, null);
|
return super.metadata.getIndex(OFFSET + 3, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSecondUUID(@Nullable UUID value) {
|
public void setSecondUUID(@Nullable UUID value) {
|
||||||
super.metadata.setIndex((byte) 19, Metadata.OptUUID(value));
|
super.metadata.setIndex(OFFSET + 3, Metadata.OptUUID(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
|
@ -5,17 +5,19 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class HoglinMeta extends AnimalMeta {
|
public class HoglinMeta extends AnimalMeta {
|
||||||
|
public static final byte OFFSET = AnimalMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
public HoglinMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public HoglinMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isImmuneToZombification() {
|
public boolean isImmuneToZombification() {
|
||||||
return super.metadata.getIndex((byte) 16, false);
|
return super.metadata.getIndex(OFFSET, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setImmuneToZombification(boolean value) {
|
public void setImmuneToZombification(boolean value) {
|
||||||
super.metadata.setIndex((byte) 16, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,17 +5,19 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class HorseMeta extends AbstractHorseMeta {
|
public class HorseMeta extends AbstractHorseMeta {
|
||||||
|
public static final byte OFFSET = AbstractHorseMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
public HorseMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public HorseMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Variant getVariant() {
|
public Variant getVariant() {
|
||||||
return getVariantFromID(super.metadata.getIndex((byte) 18, 0));
|
return getVariantFromID(super.metadata.getIndex(OFFSET, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVariant(Variant variant) {
|
public void setVariant(Variant variant) {
|
||||||
super.metadata.setIndex((byte) 18, Metadata.VarInt(getVariantID(variant.marking, variant.color)));
|
super.metadata.setIndex(OFFSET, Metadata.VarInt(getVariantID(variant.marking, variant.color)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getVariantID(@NotNull Marking marking, @NotNull Color color) {
|
public static int getVariantID(@NotNull Marking marking, @NotNull Color color) {
|
||||||
|
@ -5,33 +5,35 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class LlamaMeta extends ChestedHorseMeta {
|
public class LlamaMeta extends ChestedHorseMeta {
|
||||||
|
public static final byte OFFSET = ChestedHorseMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 3;
|
||||||
|
|
||||||
public LlamaMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public LlamaMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStrength() {
|
public int getStrength() {
|
||||||
return super.metadata.getIndex((byte) 19, 0);
|
return super.metadata.getIndex(OFFSET, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStrength(int value) {
|
public void setStrength(int value) {
|
||||||
super.metadata.setIndex((byte) 19, Metadata.VarInt(value));
|
super.metadata.setIndex(OFFSET, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCarpetColor() {
|
public int getCarpetColor() {
|
||||||
return super.metadata.getIndex((byte) 20, -1);
|
return super.metadata.getIndex(OFFSET + 1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCarpetColor(int value) {
|
public void setCarpetColor(int value) {
|
||||||
super.metadata.setIndex((byte) 20, Metadata.VarInt(value));
|
super.metadata.setIndex(OFFSET + 1, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Variant getVariant() {
|
public Variant getVariant() {
|
||||||
return Variant.VALUES[super.metadata.getIndex((byte) 21, 0)];
|
return Variant.VALUES[super.metadata.getIndex(OFFSET + 2, 0)];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVariant(Variant value) {
|
public void setVariant(Variant value) {
|
||||||
super.metadata.setIndex((byte) 21, Metadata.VarInt(value.ordinal()));
|
super.metadata.setIndex(OFFSET + 2, Metadata.VarInt(value.ordinal()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Variant {
|
public enum Variant {
|
||||||
|
@ -7,6 +7,8 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class MooshroomMeta extends CowMeta {
|
public class MooshroomMeta extends CowMeta {
|
||||||
|
public static final byte OFFSET = CowMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
public MooshroomMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public MooshroomMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
@ -14,11 +16,11 @@ public class MooshroomMeta extends CowMeta {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public Variant getVariant() {
|
public Variant getVariant() {
|
||||||
return Variant.valueOf(super.metadata.getIndex((byte) 16, "red").toUpperCase(Locale.ROOT));
|
return Variant.valueOf(super.metadata.getIndex(OFFSET, "red").toUpperCase(Locale.ROOT));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVariant(@NotNull Variant value) {
|
public void setVariant(@NotNull Variant value) {
|
||||||
super.metadata.setIndex((byte) 16, Metadata.String(value.name().toLowerCase(Locale.ROOT)));
|
super.metadata.setIndex(OFFSET, Metadata.String(value.name().toLowerCase(Locale.ROOT)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Variant {
|
public enum Variant {
|
||||||
|
@ -5,6 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class MuleMeta extends ChestedHorseMeta {
|
public class MuleMeta extends ChestedHorseMeta {
|
||||||
|
public static final byte OFFSET = ChestedHorseMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public MuleMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public MuleMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -5,17 +5,19 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class OcelotMeta extends AnimalMeta {
|
public class OcelotMeta extends AnimalMeta {
|
||||||
|
public static final byte OFFSET = AnimalMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
public OcelotMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public OcelotMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTrusting() {
|
public boolean isTrusting() {
|
||||||
return super.metadata.getIndex((byte) 16, false);
|
return super.metadata.getIndex(OFFSET, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTrusting(boolean value) {
|
public void setTrusting(boolean value) {
|
||||||
super.metadata.setIndex((byte) 16, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class PandaMeta extends AnimalMeta {
|
public class PandaMeta extends AnimalMeta {
|
||||||
|
public static final byte OFFSET = AnimalMeta.MAX_OFFSET;
|
||||||
private final static byte MASK_INDEX = 21;
|
public static final byte MAX_OFFSET = OFFSET + 6;
|
||||||
|
|
||||||
private final static byte SNEEZING_BIT = 0x02;
|
private final static byte SNEEZING_BIT = 0x02;
|
||||||
private final static byte ROLLING_BIT = 0x04;
|
private final static byte ROLLING_BIT = 0x04;
|
||||||
@ -18,77 +18,77 @@ public class PandaMeta extends AnimalMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getBreedTimer() {
|
public int getBreedTimer() {
|
||||||
return super.metadata.getIndex((byte) 16, 0);
|
return super.metadata.getIndex(OFFSET, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBreedTimer(int value) {
|
public void setBreedTimer(int value) {
|
||||||
super.metadata.setIndex((byte) 16, Metadata.VarInt(value));
|
super.metadata.setIndex(OFFSET, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSneezeTimer() {
|
public int getSneezeTimer() {
|
||||||
return super.metadata.getIndex((byte) 17, 0);
|
return super.metadata.getIndex(OFFSET + 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSneezeTimer(int value) {
|
public void setSneezeTimer(int value) {
|
||||||
super.metadata.setIndex((byte) 17, Metadata.VarInt(value));
|
super.metadata.setIndex(OFFSET + 1, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getEatTimer() {
|
public int getEatTimer() {
|
||||||
return super.metadata.getIndex((byte) 18, 0);
|
return super.metadata.getIndex(OFFSET + 2, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEatTimer(int value) {
|
public void setEatTimer(int value) {
|
||||||
super.metadata.setIndex((byte) 18, Metadata.VarInt(value));
|
super.metadata.setIndex(OFFSET + 2, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public Gene getMainGene() {
|
public Gene getMainGene() {
|
||||||
return Gene.VALUES[super.metadata.getIndex((byte) 19, (byte) 0)];
|
return Gene.VALUES[super.metadata.getIndex(OFFSET + 3, (byte) 0)];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMainGene(@NotNull Gene value) {
|
public void setMainGene(@NotNull Gene value) {
|
||||||
super.metadata.setIndex((byte) 19, Metadata.Byte((byte) value.ordinal()));
|
super.metadata.setIndex(OFFSET + 3, Metadata.Byte((byte) value.ordinal()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public Gene getHiddenGene() {
|
public Gene getHiddenGene() {
|
||||||
return Gene.VALUES[super.metadata.getIndex((byte) 20, (byte) 0)];
|
return Gene.VALUES[super.metadata.getIndex(OFFSET + 4, (byte) 0)];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHiddenGene(@NotNull Gene value) {
|
public void setHiddenGene(@NotNull Gene value) {
|
||||||
super.metadata.setIndex((byte) 20, Metadata.Byte((byte) value.ordinal()));
|
super.metadata.setIndex(OFFSET + 4, Metadata.Byte((byte) value.ordinal()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSneezing() {
|
public boolean isSneezing() {
|
||||||
return getMaskBit(MASK_INDEX, SNEEZING_BIT);
|
return getMaskBit(OFFSET + 5, SNEEZING_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSneezing(boolean value) {
|
public void setSneezing(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, SNEEZING_BIT, value);
|
setMaskBit(OFFSET + 5, SNEEZING_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRolling() {
|
public boolean isRolling() {
|
||||||
return getMaskBit(MASK_INDEX, ROLLING_BIT);
|
return getMaskBit(OFFSET + 5, ROLLING_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRolling(boolean value) {
|
public void setRolling(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, ROLLING_BIT, value);
|
setMaskBit(OFFSET + 5, ROLLING_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSitting() {
|
public boolean isSitting() {
|
||||||
return getMaskBit(MASK_INDEX, SITTING_BIT);
|
return getMaskBit(OFFSET + 5, SITTING_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSitting(boolean value) {
|
public void setSitting(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, SITTING_BIT, value);
|
setMaskBit(OFFSET + 5, SITTING_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOnBack() {
|
public boolean isOnBack() {
|
||||||
return getMaskBit(MASK_INDEX, ON_BACK_BIT);
|
return getMaskBit(OFFSET + 5, ON_BACK_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnBack(boolean value) {
|
public void setOnBack(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, ON_BACK_BIT, value);
|
setMaskBit(OFFSET + 5, ON_BACK_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Gene {
|
public enum Gene {
|
||||||
|
@ -5,25 +5,27 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class PigMeta extends AnimalMeta {
|
public class PigMeta extends AnimalMeta {
|
||||||
|
public static final byte OFFSET = AnimalMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 2;
|
||||||
|
|
||||||
public PigMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public PigMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHasSaddle() {
|
public boolean isHasSaddle() {
|
||||||
return super.metadata.getIndex((byte) 16, false);
|
return super.metadata.getIndex(OFFSET, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHasSaddle(boolean value) {
|
public void setHasSaddle(boolean value) {
|
||||||
super.metadata.setIndex((byte) 16, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeToBoost() {
|
public int getTimeToBoost() {
|
||||||
return super.metadata.getIndex((byte) 17, 0);
|
return super.metadata.getIndex(OFFSET + 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTimeToBoost(int value) {
|
public void setTimeToBoost(int value) {
|
||||||
super.metadata.getIndex((byte) 17, Metadata.VarInt(value));
|
super.metadata.getIndex(OFFSET + 1, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,17 +5,19 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class PolarBearMeta extends AnimalMeta {
|
public class PolarBearMeta extends AnimalMeta {
|
||||||
|
public static final byte OFFSET = AnimalMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
public PolarBearMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public PolarBearMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isStandingUp() {
|
public boolean isStandingUp() {
|
||||||
return super.metadata.getIndex((byte) 16, false);
|
return super.metadata.getIndex(OFFSET, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStandingUp(boolean value) {
|
public void setStandingUp(boolean value) {
|
||||||
super.metadata.setIndex((byte) 16, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class RabbitMeta extends AnimalMeta {
|
public class RabbitMeta extends AnimalMeta {
|
||||||
|
public static final byte OFFSET = AnimalMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
public RabbitMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public RabbitMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
@ -12,7 +14,7 @@ public class RabbitMeta extends AnimalMeta {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public Type getType() {
|
public Type getType() {
|
||||||
int id = super.metadata.getIndex((byte) 16, 0);
|
int id = super.metadata.getIndex(OFFSET, 0);
|
||||||
if (id == 99) {
|
if (id == 99) {
|
||||||
return Type.KILLER_BUNNY;
|
return Type.KILLER_BUNNY;
|
||||||
}
|
}
|
||||||
@ -21,7 +23,7 @@ public class RabbitMeta extends AnimalMeta {
|
|||||||
|
|
||||||
public void setType(@NotNull Type value) {
|
public void setType(@NotNull Type value) {
|
||||||
int id = value == Type.KILLER_BUNNY ? 99 : value.ordinal();
|
int id = value == Type.KILLER_BUNNY ? 99 : value.ordinal();
|
||||||
super.metadata.setIndex((byte) 16, Metadata.VarInt(id));
|
super.metadata.setIndex(OFFSET, Metadata.VarInt(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
|
@ -5,8 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class SheepMeta extends AnimalMeta {
|
public class SheepMeta extends AnimalMeta {
|
||||||
|
public static final byte OFFSET = AnimalMeta.MAX_OFFSET;
|
||||||
private final static byte MASK_INDEX = 16;
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
private final static byte COLOR_BITS = 0x0F;
|
private final static byte COLOR_BITS = 0x0F;
|
||||||
private final static byte SHEARED_BIT = 0x10;
|
private final static byte SHEARED_BIT = 0x10;
|
||||||
@ -16,25 +16,25 @@ public class SheepMeta extends AnimalMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getColor() {
|
public int getColor() {
|
||||||
return getMask(MASK_INDEX) & COLOR_BITS;
|
return getMask(OFFSET) & COLOR_BITS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColor(byte color) {
|
public void setColor(byte color) {
|
||||||
byte before = getMask(MASK_INDEX);
|
byte before = getMask(OFFSET);
|
||||||
byte mask = before;
|
byte mask = before;
|
||||||
mask &= ~COLOR_BITS;
|
mask &= ~COLOR_BITS;
|
||||||
mask |= (color & COLOR_BITS);
|
mask |= (color & COLOR_BITS);
|
||||||
if (mask != before) {
|
if (mask != before) {
|
||||||
setMask(MASK_INDEX, mask);
|
setMask(OFFSET, mask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSheared() {
|
public boolean isSheared() {
|
||||||
return getMaskBit(MASK_INDEX, SHEARED_BIT);
|
return getMaskBit(OFFSET, SHEARED_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSheared(boolean value) {
|
public void setSheared(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, SHEARED_BIT, value);
|
setMaskBit(OFFSET, SHEARED_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class SkeletonHorseMeta extends AbstractHorseMeta {
|
public class SkeletonHorseMeta extends AbstractHorseMeta {
|
||||||
|
public static final byte OFFSET = AbstractHorseMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public SkeletonHorseMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public SkeletonHorseMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -5,33 +5,35 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class StriderMeta extends AnimalMeta {
|
public class StriderMeta extends AnimalMeta {
|
||||||
|
public static final byte OFFSET = AnimalMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 3;
|
||||||
|
|
||||||
public StriderMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public StriderMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeToBoost() {
|
public int getTimeToBoost() {
|
||||||
return super.metadata.getIndex((byte) 16, 0);
|
return super.metadata.getIndex(OFFSET, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTimeToBoost(int value) {
|
public void setTimeToBoost(int value) {
|
||||||
super.metadata.setIndex((byte) 16, Metadata.VarInt(value));
|
super.metadata.setIndex(OFFSET, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isShaking() {
|
public boolean isShaking() {
|
||||||
return super.metadata.getIndex((byte) 17, false);
|
return super.metadata.getIndex(OFFSET + 1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setShaking(boolean value) {
|
public void setShaking(boolean value) {
|
||||||
super.metadata.setIndex((byte) 17, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET + 1, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHasSaddle() {
|
public boolean isHasSaddle() {
|
||||||
return super.metadata.getIndex((byte) 18, false);
|
return super.metadata.getIndex(OFFSET + 2, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHasSaddle(boolean value) {
|
public void setHasSaddle(boolean value) {
|
||||||
super.metadata.setIndex((byte) 18, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET + 2, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@ import net.minestom.server.utils.BlockPosition;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class TurtleMeta extends AnimalMeta {
|
public class TurtleMeta extends AnimalMeta {
|
||||||
|
public static final byte OFFSET = AnimalMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 6;
|
||||||
|
|
||||||
public TurtleMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public TurtleMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
@ -13,52 +15,52 @@ public class TurtleMeta extends AnimalMeta {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public BlockPosition getHomePosition() {
|
public BlockPosition getHomePosition() {
|
||||||
return super.metadata.getIndex((byte) 16, new BlockPosition(0, 0, 0));
|
return super.metadata.getIndex(OFFSET, new BlockPosition(0, 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlockPosition(@NotNull BlockPosition value) {
|
public void setBlockPosition(@NotNull BlockPosition value) {
|
||||||
super.metadata.setIndex((byte) 16, Metadata.Position(value));
|
super.metadata.setIndex(OFFSET, Metadata.Position(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHasEgg() {
|
public boolean isHasEgg() {
|
||||||
return super.metadata.getIndex((byte) 17, false);
|
return super.metadata.getIndex(OFFSET + 1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHasEgg(boolean value) {
|
public void setHasEgg(boolean value) {
|
||||||
super.metadata.setIndex((byte) 17, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET + 1, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLayingEgg() {
|
public boolean isLayingEgg() {
|
||||||
return super.metadata.getIndex((byte) 18, false);
|
return super.metadata.getIndex(OFFSET + 2, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLayingEgg(boolean value) {
|
public void setLayingEgg(boolean value) {
|
||||||
super.metadata.setIndex((byte) 18, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET + 2, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public BlockPosition getTravelPosition() {
|
public BlockPosition getTravelPosition() {
|
||||||
return super.metadata.getIndex((byte) 19, new BlockPosition(0, 0, 0));
|
return super.metadata.getIndex(OFFSET + 3, new BlockPosition(0, 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTravelPosition(@NotNull BlockPosition value) {
|
public void setTravelPosition(@NotNull BlockPosition value) {
|
||||||
super.metadata.setIndex((byte) 19, Metadata.Position(value));
|
super.metadata.setIndex(OFFSET + 3, Metadata.Position(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isGoingHome() {
|
public boolean isGoingHome() {
|
||||||
return super.metadata.getIndex((byte) 20, false);
|
return super.metadata.getIndex(OFFSET + 4, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGoingHome(boolean value) {
|
public void setGoingHome(boolean value) {
|
||||||
super.metadata.setIndex((byte) 20, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET + 4, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTravelling() {
|
public boolean isTravelling() {
|
||||||
return super.metadata.getIndex((byte) 21, false);
|
return super.metadata.getIndex(OFFSET + 5, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTravelling(boolean value) {
|
public void setTravelling(boolean value) {
|
||||||
super.metadata.setIndex((byte) 21, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET + 5, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class ZombieHorseMeta extends AbstractHorseMeta {
|
public class ZombieHorseMeta extends AbstractHorseMeta {
|
||||||
|
public static final byte OFFSET = AbstractHorseMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public ZombieHorseMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public ZombieHorseMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -2,9 +2,12 @@ package net.minestom.server.entity.metadata.animal.tameable;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.animal.AnimalMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class CatMeta extends TameableAnimalMeta {
|
public class CatMeta extends TameableAnimalMeta {
|
||||||
|
public static final byte OFFSET = TameableAnimalMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 4;
|
||||||
|
|
||||||
public CatMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public CatMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
@ -12,35 +15,35 @@ public class CatMeta extends TameableAnimalMeta {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public Color getColor() {
|
public Color getColor() {
|
||||||
return Color.VALUES[super.metadata.getIndex((byte) 18, 1)];
|
return Color.VALUES[super.metadata.getIndex(OFFSET, 1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColor(@NotNull Color value) {
|
public void setColor(@NotNull Color value) {
|
||||||
super.metadata.setIndex((byte) 18, Metadata.VarInt(value.ordinal()));
|
super.metadata.setIndex(OFFSET, Metadata.VarInt(value.ordinal()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLying() {
|
public boolean isLying() {
|
||||||
return super.metadata.getIndex((byte) 19, false);
|
return super.metadata.getIndex(OFFSET + 1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLying(boolean value) {
|
public void setLying(boolean value) {
|
||||||
super.metadata.setIndex((byte) 19, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET + 1, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRelaxed() {
|
public boolean isRelaxed() {
|
||||||
return super.metadata.getIndex((byte) 20, false);
|
return super.metadata.getIndex(OFFSET + 2, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRelaxed(boolean value) {
|
public void setRelaxed(boolean value) {
|
||||||
super.metadata.setIndex((byte) 20, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET + 2, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCollarColor() {
|
public int getCollarColor() {
|
||||||
return super.metadata.getIndex((byte) 21, 14);
|
return super.metadata.getIndex(OFFSET + 3, 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCollarColor(int value) {
|
public void setCollarColor(int value) {
|
||||||
super.metadata.setIndex((byte) 21, Metadata.VarInt(value));
|
super.metadata.setIndex(OFFSET + 3, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Color {
|
public enum Color {
|
||||||
|
@ -2,9 +2,12 @@ package net.minestom.server.entity.metadata.animal.tameable;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.animal.AnimalMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class ParrotMeta extends TameableAnimalMeta {
|
public class ParrotMeta extends TameableAnimalMeta {
|
||||||
|
public static final byte OFFSET = TameableAnimalMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
public ParrotMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public ParrotMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
@ -12,11 +15,11 @@ public class ParrotMeta extends TameableAnimalMeta {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public Color getColor() {
|
public Color getColor() {
|
||||||
return Color.VALUES[super.metadata.getIndex((byte) 18, 0)];
|
return Color.VALUES[super.metadata.getIndex(OFFSET, 0)];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColor(@NotNull Color value) {
|
public void setColor(@NotNull Color value) {
|
||||||
super.metadata.setIndex((byte) 18, Metadata.VarInt(value.ordinal()));
|
super.metadata.setIndex(OFFSET, Metadata.VarInt(value.ordinal()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Color {
|
public enum Color {
|
||||||
|
@ -8,8 +8,8 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class TameableAnimalMeta extends AnimalMeta {
|
public class TameableAnimalMeta extends AnimalMeta {
|
||||||
|
public static final byte OFFSET = AnimalMeta.MAX_OFFSET;
|
||||||
private final static byte MASK_INDEX = 16;
|
public static final byte MAX_OFFSET = OFFSET + 2;
|
||||||
|
|
||||||
private final static byte SITTING_BIT = 0x01;
|
private final static byte SITTING_BIT = 0x01;
|
||||||
private final static byte TAMED_BIT = 0x04;
|
private final static byte TAMED_BIT = 0x04;
|
||||||
@ -19,28 +19,28 @@ public class TameableAnimalMeta extends AnimalMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSitting() {
|
public boolean isSitting() {
|
||||||
return getMaskBit(MASK_INDEX, SITTING_BIT);
|
return getMaskBit(OFFSET, SITTING_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSitting(boolean value) {
|
public void setSitting(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, SITTING_BIT, value);
|
setMaskBit(OFFSET, SITTING_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTamed() {
|
public boolean isTamed() {
|
||||||
return getMaskBit(MASK_INDEX, TAMED_BIT);
|
return getMaskBit(OFFSET, TAMED_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTamed(boolean value) {
|
public void setTamed(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, TAMED_BIT, value);
|
setMaskBit(OFFSET, TAMED_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public UUID getOwner() {
|
public UUID getOwner() {
|
||||||
return super.metadata.getIndex((byte) 17, null);
|
return super.metadata.getIndex(OFFSET + 1, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOwner(@NotNull UUID value) {
|
public void setOwner(@NotNull UUID value) {
|
||||||
super.metadata.setIndex((byte) 17, Metadata.OptUUID(value));
|
super.metadata.setIndex(OFFSET + 1, Metadata.OptUUID(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,33 +5,35 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class WolfMeta extends TameableAnimalMeta {
|
public class WolfMeta extends TameableAnimalMeta {
|
||||||
|
public static final byte OFFSET = TameableAnimalMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 3;
|
||||||
|
|
||||||
public WolfMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public WolfMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBegging() {
|
public boolean isBegging() {
|
||||||
return super.metadata.getIndex((byte) 18, false);
|
return super.metadata.getIndex(OFFSET, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBegging(boolean value) {
|
public void setBegging(boolean value) {
|
||||||
super.metadata.setIndex((byte) 18, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCollarColor() {
|
public int getCollarColor() {
|
||||||
return super.metadata.getIndex((byte) 19, 14);
|
return super.metadata.getIndex(OFFSET + 1, 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCollarColor(int value) {
|
public void setCollarColor(int value) {
|
||||||
super.metadata.setIndex((byte) 19, Metadata.VarInt(value));
|
super.metadata.setIndex(OFFSET + 1, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAngerTime() {
|
public int getAngerTime() {
|
||||||
return super.metadata.getIndex((byte) 20, 0);
|
return super.metadata.getIndex(OFFSET + 2, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAngerTime(int value) {
|
public void setAngerTime(int value) {
|
||||||
super.metadata.setIndex((byte) 20, Metadata.VarInt(value));
|
super.metadata.setIndex(OFFSET + 2, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,12 @@ package net.minestom.server.entity.metadata.arrow;
|
|||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
import net.minestom.server.entity.metadata.EntityMeta;
|
import net.minestom.server.entity.metadata.EntityMeta;
|
||||||
|
import net.minestom.server.entity.metadata.animal.tameable.TameableAnimalMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class AbstractArrowMeta extends EntityMeta {
|
public class AbstractArrowMeta extends EntityMeta {
|
||||||
|
public static final byte OFFSET = EntityMeta.MAX_OFFSET;
|
||||||
private final static byte MASK_INDEX = 7;
|
public static final byte MAX_OFFSET = OFFSET + 2;
|
||||||
|
|
||||||
private final static byte CRITICAL_BIT = 0x01;
|
private final static byte CRITICAL_BIT = 0x01;
|
||||||
private final static byte NO_CLIP_BIT = 0x01;
|
private final static byte NO_CLIP_BIT = 0x01;
|
||||||
@ -17,27 +18,27 @@ public class AbstractArrowMeta extends EntityMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCritical() {
|
public boolean isCritical() {
|
||||||
return getMaskBit(MASK_INDEX, CRITICAL_BIT);
|
return getMaskBit(OFFSET, CRITICAL_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCritical(boolean value) {
|
public void setCritical(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, CRITICAL_BIT, value);
|
setMaskBit(OFFSET, CRITICAL_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNoClip() {
|
public boolean isNoClip() {
|
||||||
return getMaskBit(MASK_INDEX, NO_CLIP_BIT);
|
return getMaskBit(OFFSET, NO_CLIP_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNoClip(boolean value) {
|
public void setNoClip(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, NO_CLIP_BIT, value);
|
setMaskBit(OFFSET, NO_CLIP_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte getPiercingLevel() {
|
public byte getPiercingLevel() {
|
||||||
return super.metadata.getIndex((byte) 8, (byte) 0);
|
return super.metadata.getIndex(OFFSET + 1, (byte) 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPiercingLevel(byte value) {
|
public void setPiercingLevel(byte value) {
|
||||||
super.metadata.setIndex((byte) 8, Metadata.Byte(value));
|
super.metadata.setIndex(OFFSET + 1, Metadata.Byte(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,13 @@ import net.minestom.server.entity.Entity;
|
|||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
import net.minestom.server.entity.metadata.ObjectDataProvider;
|
import net.minestom.server.entity.metadata.ObjectDataProvider;
|
||||||
import net.minestom.server.entity.metadata.ProjectileMeta;
|
import net.minestom.server.entity.metadata.ProjectileMeta;
|
||||||
|
import net.minestom.server.entity.metadata.animal.tameable.TameableAnimalMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class ArrowMeta extends AbstractArrowMeta implements ObjectDataProvider, ProjectileMeta {
|
public class ArrowMeta extends AbstractArrowMeta implements ObjectDataProvider, ProjectileMeta {
|
||||||
|
public static final byte OFFSET = AbstractArrowMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
private Entity shooter;
|
private Entity shooter;
|
||||||
|
|
||||||
@ -16,11 +19,11 @@ public class ArrowMeta extends AbstractArrowMeta implements ObjectDataProvider,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getColor() {
|
public int getColor() {
|
||||||
return super.metadata.getIndex((byte) 9, -1);
|
return super.metadata.getIndex(OFFSET, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColor(int value) {
|
public void setColor(int value) {
|
||||||
super.metadata.setIndex((byte) 9, Metadata.VarInt(value));
|
super.metadata.setIndex(OFFSET, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -8,6 +8,8 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class SpectralArrowMeta extends AbstractArrowMeta implements ObjectDataProvider, ProjectileMeta {
|
public class SpectralArrowMeta extends AbstractArrowMeta implements ObjectDataProvider, ProjectileMeta {
|
||||||
|
public static final byte OFFSET = AbstractArrowMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
private Entity shooter;
|
private Entity shooter;
|
||||||
|
|
||||||
|
@ -5,25 +5,27 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class ThrownTridentMeta extends AbstractArrowMeta {
|
public class ThrownTridentMeta extends AbstractArrowMeta {
|
||||||
|
public static final byte OFFSET = AbstractArrowMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 2;
|
||||||
|
|
||||||
public ThrownTridentMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public ThrownTridentMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLoyaltyLevel() {
|
public int getLoyaltyLevel() {
|
||||||
return super.metadata.getIndex((byte) 9, 0);
|
return super.metadata.getIndex(OFFSET, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLoyaltyLevel(int value) {
|
public void setLoyaltyLevel(int value) {
|
||||||
super.metadata.setIndex((byte) 9, Metadata.VarInt(value));
|
super.metadata.setIndex(OFFSET, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHasEnchantmentGlint() {
|
public boolean isHasEnchantmentGlint() {
|
||||||
return super.metadata.getIndex((byte) 10, false);
|
return super.metadata.getIndex(OFFSET + 1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHasEnchantmentGlint(boolean value) {
|
public void setHasEnchantmentGlint(boolean value) {
|
||||||
super.metadata.setIndex((byte) 10, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET + 1, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,12 @@ package net.minestom.server.entity.metadata.flying;
|
|||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
import net.minestom.server.entity.metadata.MobMeta;
|
import net.minestom.server.entity.metadata.MobMeta;
|
||||||
|
import net.minestom.server.entity.metadata.arrow.AbstractArrowMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class FlyingMeta extends MobMeta {
|
public class FlyingMeta extends MobMeta {
|
||||||
|
public static final byte OFFSET = MobMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
protected FlyingMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
protected FlyingMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -2,20 +2,23 @@ package net.minestom.server.entity.metadata.flying;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.MobMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class GhastMeta extends FlyingMeta {
|
public class GhastMeta extends FlyingMeta {
|
||||||
|
public static final byte OFFSET = FlyingMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
public GhastMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public GhastMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAttacking() {
|
public boolean isAttacking() {
|
||||||
return super.metadata.getIndex((byte) 15, false);
|
return super.metadata.getIndex(OFFSET, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAttacking(boolean value) {
|
public void setAttacking(boolean value) {
|
||||||
super.metadata.setIndex((byte) 15, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,20 +2,23 @@ package net.minestom.server.entity.metadata.flying;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.MobMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class PhantomMeta extends FlyingMeta {
|
public class PhantomMeta extends FlyingMeta {
|
||||||
|
public static final byte OFFSET = FlyingMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
public PhantomMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public PhantomMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return super.metadata.getIndex((byte) 15, 0);
|
return super.metadata.getIndex(OFFSET, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSize(int value) {
|
public void setSize(int value) {
|
||||||
super.metadata.setIndex((byte) 15, Metadata.VarInt(value));
|
super.metadata.setIndex(OFFSET, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,13 @@ package net.minestom.server.entity.metadata.golem;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.MobMeta;
|
||||||
import net.minestom.server.entity.metadata.PathfinderMobMeta;
|
import net.minestom.server.entity.metadata.PathfinderMobMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class AbstractGolemMeta extends PathfinderMobMeta {
|
public class AbstractGolemMeta extends PathfinderMobMeta {
|
||||||
|
public static final byte OFFSET = PathfinderMobMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
protected AbstractGolemMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
protected AbstractGolemMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -2,11 +2,12 @@ package net.minestom.server.entity.metadata.golem;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.MobMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class IronGolemMeta extends AbstractGolemMeta {
|
public class IronGolemMeta extends AbstractGolemMeta {
|
||||||
|
public static final byte OFFSET = AbstractGolemMeta.MAX_OFFSET;
|
||||||
private final static byte MASK_INDEX = 15;
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
private final static byte PLAYER_CREATED_BIT = 0x01;
|
private final static byte PLAYER_CREATED_BIT = 0x01;
|
||||||
|
|
||||||
@ -15,11 +16,11 @@ public class IronGolemMeta extends AbstractGolemMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPlayerCreated() {
|
public boolean isPlayerCreated() {
|
||||||
return getMaskBit(MASK_INDEX, PLAYER_CREATED_BIT);
|
return getMaskBit(OFFSET, PLAYER_CREATED_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPlayerCreated(boolean value) {
|
public void setPlayerCreated(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, PLAYER_CREATED_BIT, value);
|
setMaskBit(OFFSET, PLAYER_CREATED_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,41 +7,43 @@ import net.minestom.server.utils.Direction;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class ShulkerMeta extends AbstractGolemMeta {
|
public class ShulkerMeta extends AbstractGolemMeta {
|
||||||
|
public static final byte OFFSET = AbstractGolemMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 4;
|
||||||
|
|
||||||
public ShulkerMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public ShulkerMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Direction getAttachFace() {
|
public Direction getAttachFace() {
|
||||||
return super.metadata.getIndex((byte) 15, Direction.DOWN);
|
return super.metadata.getIndex(OFFSET, Direction.DOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAttachFace(Direction value) {
|
public void setAttachFace(Direction value) {
|
||||||
super.metadata.setIndex((byte) 15, Metadata.Direction(value));
|
super.metadata.setIndex(OFFSET, Metadata.Direction(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockPosition getAttachmentPosition() {
|
public BlockPosition getAttachmentPosition() {
|
||||||
return super.metadata.getIndex((byte) 16, null);
|
return super.metadata.getIndex(OFFSET + 1, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAttachmentPosition(BlockPosition value) {
|
public void setAttachmentPosition(BlockPosition value) {
|
||||||
super.metadata.setIndex((byte) 16, Metadata.OptPosition(value));
|
super.metadata.setIndex(OFFSET + 1, Metadata.OptPosition(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte getShieldHeight() {
|
public byte getShieldHeight() {
|
||||||
return super.metadata.getIndex((byte) 17, (byte) 0);
|
return super.metadata.getIndex(OFFSET + 2, (byte) 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setShieldHeight(byte value) {
|
public void setShieldHeight(byte value) {
|
||||||
super.metadata.setIndex((byte) 17, Metadata.Byte(value));
|
super.metadata.setIndex(OFFSET + 2, Metadata.Byte(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte getColor() {
|
public byte getColor() {
|
||||||
return super.metadata.getIndex((byte) 18, (byte) 10);
|
return super.metadata.getIndex(OFFSET + 3, (byte) 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColor(byte value) {
|
public void setColor(byte value) {
|
||||||
super.metadata.setIndex((byte) 18, Metadata.Byte(value));
|
super.metadata.setIndex(OFFSET + 3, Metadata.Byte(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,17 +5,19 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class SnowGolemMeta extends AbstractGolemMeta {
|
public class SnowGolemMeta extends AbstractGolemMeta {
|
||||||
|
public static final byte OFFSET = AbstractGolemMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
public SnowGolemMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public SnowGolemMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHasPumpkinHat() {
|
public boolean isHasPumpkinHat() {
|
||||||
return super.metadata.getIndex((byte) 15, (byte) 0x10) == (byte) 0x10;
|
return super.metadata.getIndex(OFFSET, (byte) 0x10) == (byte) 0x10;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHasPumpkinHat(boolean value) {
|
public void setHasPumpkinHat(boolean value) {
|
||||||
super.metadata.setIndex((byte) 15, Metadata.Byte(value ? (byte) 0x10 : (byte) 0x00));
|
super.metadata.setIndex(OFFSET, Metadata.Byte(value ? (byte) 0x10 : (byte) 0x00));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@ import net.minestom.server.item.Material;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class EyeOfEnderMeta extends ItemContainingMeta {
|
public class EyeOfEnderMeta extends ItemContainingMeta {
|
||||||
|
public static final byte OFFSET = ItemContainingMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public EyeOfEnderMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public EyeOfEnderMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata, Material.ENDER_EYE);
|
super(entity, metadata, Material.ENDER_EYE);
|
||||||
|
@ -4,11 +4,14 @@ import net.minestom.server.entity.Entity;
|
|||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
import net.minestom.server.entity.metadata.ObjectDataProvider;
|
import net.minestom.server.entity.metadata.ObjectDataProvider;
|
||||||
import net.minestom.server.entity.metadata.ProjectileMeta;
|
import net.minestom.server.entity.metadata.ProjectileMeta;
|
||||||
|
import net.minestom.server.entity.metadata.golem.AbstractGolemMeta;
|
||||||
import net.minestom.server.item.Material;
|
import net.minestom.server.item.Material;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class FireballMeta extends ItemContainingMeta implements ObjectDataProvider, ProjectileMeta {
|
public class FireballMeta extends ItemContainingMeta implements ObjectDataProvider, ProjectileMeta {
|
||||||
|
public static final byte OFFSET = ItemContainingMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
private Entity shooter;
|
private Entity shooter;
|
||||||
|
|
||||||
|
@ -3,11 +3,14 @@ package net.minestom.server.entity.metadata.item;
|
|||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
import net.minestom.server.entity.metadata.EntityMeta;
|
import net.minestom.server.entity.metadata.EntityMeta;
|
||||||
|
import net.minestom.server.entity.metadata.golem.AbstractGolemMeta;
|
||||||
import net.minestom.server.item.ItemStack;
|
import net.minestom.server.item.ItemStack;
|
||||||
import net.minestom.server.item.Material;
|
import net.minestom.server.item.Material;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
class ItemContainingMeta extends EntityMeta {
|
class ItemContainingMeta extends EntityMeta {
|
||||||
|
public static final byte OFFSET = EntityMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
private final ItemStack defaultItem;
|
private final ItemStack defaultItem;
|
||||||
|
|
||||||
@ -18,11 +21,11 @@ class ItemContainingMeta extends EntityMeta {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public ItemStack getItem() {
|
public ItemStack getItem() {
|
||||||
return super.metadata.getIndex((byte) 7, this.defaultItem);
|
return super.metadata.getIndex(OFFSET, this.defaultItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setItem(@NotNull ItemStack item) {
|
public void setItem(@NotNull ItemStack item) {
|
||||||
super.metadata.setIndex((byte) 7, Metadata.Slot(item));
|
super.metadata.setIndex(OFFSET, Metadata.Slot(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,8 @@ import net.minestom.server.item.Material;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class ItemEntityMeta extends ItemContainingMeta implements ObjectDataProvider {
|
public class ItemEntityMeta extends ItemContainingMeta implements ObjectDataProvider {
|
||||||
|
public static final byte OFFSET = ItemContainingMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public ItemEntityMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public ItemEntityMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata, Material.AIR);
|
super(entity, metadata, Material.AIR);
|
||||||
|
@ -9,6 +9,8 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class SmallFireballMeta extends ItemContainingMeta implements ObjectDataProvider, ProjectileMeta {
|
public class SmallFireballMeta extends ItemContainingMeta implements ObjectDataProvider, ProjectileMeta {
|
||||||
|
public static final byte OFFSET = ItemContainingMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
private Entity shooter;
|
private Entity shooter;
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ import net.minestom.server.item.Material;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class SnowballMeta extends ItemContainingMeta {
|
public class SnowballMeta extends ItemContainingMeta {
|
||||||
|
public static final byte OFFSET = ItemContainingMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public SnowballMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public SnowballMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata, Material.SNOWBALL);
|
super(entity, metadata, Material.SNOWBALL);
|
||||||
|
@ -6,6 +6,8 @@ import net.minestom.server.item.Material;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class ThrownEggMeta extends ItemContainingMeta {
|
public class ThrownEggMeta extends ItemContainingMeta {
|
||||||
|
public static final byte OFFSET = ItemContainingMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public ThrownEggMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public ThrownEggMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata, Material.EGG);
|
super(entity, metadata, Material.EGG);
|
||||||
|
@ -6,6 +6,8 @@ import net.minestom.server.item.Material;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class ThrownEnderPearlMeta extends ItemContainingMeta {
|
public class ThrownEnderPearlMeta extends ItemContainingMeta {
|
||||||
|
public static final byte OFFSET = ItemContainingMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public ThrownEnderPearlMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public ThrownEnderPearlMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata, Material.ENDER_PEARL);
|
super(entity, metadata, Material.ENDER_PEARL);
|
||||||
|
@ -6,6 +6,8 @@ import net.minestom.server.item.Material;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class ThrownExperienceBottleMeta extends ItemContainingMeta {
|
public class ThrownExperienceBottleMeta extends ItemContainingMeta {
|
||||||
|
public static final byte OFFSET = ItemContainingMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public ThrownExperienceBottleMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public ThrownExperienceBottleMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata, Material.EXPERIENCE_BOTTLE);
|
super(entity, metadata, Material.EXPERIENCE_BOTTLE);
|
||||||
|
@ -6,6 +6,8 @@ import net.minestom.server.item.Material;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class ThrownPotionMeta extends ItemContainingMeta {
|
public class ThrownPotionMeta extends ItemContainingMeta {
|
||||||
|
public static final byte OFFSET = ItemContainingMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public ThrownPotionMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public ThrownPotionMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata, Material.AIR);
|
super(entity, metadata, Material.AIR);
|
||||||
|
@ -5,6 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public abstract class AbstractMinecartContainerMeta extends AbstractMinecartMeta {
|
public abstract class AbstractMinecartContainerMeta extends AbstractMinecartMeta {
|
||||||
|
public static final byte OFFSET = AbstractMinecartMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
protected AbstractMinecartContainerMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
protected AbstractMinecartContainerMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -7,50 +7,52 @@ import net.minestom.server.entity.metadata.ObjectDataProvider;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public abstract class AbstractMinecartMeta extends EntityMeta implements ObjectDataProvider {
|
public abstract class AbstractMinecartMeta extends EntityMeta implements ObjectDataProvider {
|
||||||
|
public static final byte OFFSET = EntityMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 6;
|
||||||
|
|
||||||
protected AbstractMinecartMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
protected AbstractMinecartMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getShakingPower() {
|
public int getShakingPower() {
|
||||||
return super.metadata.getIndex((byte) 7, 0);
|
return super.metadata.getIndex(OFFSET, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setShakingPower(int value) {
|
public void setShakingPower(int value) {
|
||||||
super.metadata.setIndex((byte) 7, Metadata.VarInt(value));
|
super.metadata.setIndex(OFFSET, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getShakingDirection() {
|
public int getShakingDirection() {
|
||||||
return super.metadata.getIndex((byte) 8, 1);
|
return super.metadata.getIndex(OFFSET + 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setShakingDirection(int value) {
|
public void setShakingDirection(int value) {
|
||||||
super.metadata.setIndex((byte) 8, Metadata.VarInt(value));
|
super.metadata.setIndex(OFFSET + 1, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getShakingMultiplier() {
|
public float getShakingMultiplier() {
|
||||||
return super.metadata.getIndex((byte) 9, 0F);
|
return super.metadata.getIndex(OFFSET + 2, 0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setShakingMultiplier(float value) {
|
public void setShakingMultiplier(float value) {
|
||||||
super.metadata.setIndex((byte) 9, Metadata.Float(value));
|
super.metadata.setIndex(OFFSET + 2, Metadata.Float(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCustomBlockIdAndDamage() {
|
public int getCustomBlockIdAndDamage() {
|
||||||
return super.metadata.getIndex((byte) 10, 0);
|
return super.metadata.getIndex(OFFSET + 3, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCustomBlockIdAndDamage(int value) {
|
public void setCustomBlockIdAndDamage(int value) {
|
||||||
super.metadata.setIndex((byte) 10, Metadata.VarInt(value));
|
super.metadata.setIndex(OFFSET + 3, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
// in 16th of a block
|
// in 16th of a block
|
||||||
public int getCustomBlockYPosition() {
|
public int getCustomBlockYPosition() {
|
||||||
return super.metadata.getIndex((byte) 11, 6);
|
return super.metadata.getIndex(OFFSET + 4, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCustomBlockYPosition(int value) {
|
public void setCustomBlockYPosition(int value) {
|
||||||
super.metadata.setIndex((byte) 11, Metadata.VarInt(value));
|
super.metadata.setIndex(OFFSET + 4, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -5,6 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class ChestMinecartMeta extends AbstractMinecartContainerMeta {
|
public class ChestMinecartMeta extends AbstractMinecartContainerMeta {
|
||||||
|
public static final byte OFFSET = AbstractMinecartContainerMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public ChestMinecartMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public ChestMinecartMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -7,6 +7,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class CommandBlockMinecartMeta extends AbstractMinecartMeta {
|
public class CommandBlockMinecartMeta extends AbstractMinecartMeta {
|
||||||
|
public static final byte OFFSET = AbstractMinecartMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 2;
|
||||||
|
|
||||||
public CommandBlockMinecartMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public CommandBlockMinecartMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
@ -14,11 +16,11 @@ public class CommandBlockMinecartMeta extends AbstractMinecartMeta {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public String getCommand() {
|
public String getCommand() {
|
||||||
return super.metadata.getIndex((byte) 13, "");
|
return super.metadata.getIndex(OFFSET, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCommand(@NotNull String value) {
|
public void setCommand(@NotNull String value) {
|
||||||
super.metadata.setIndex((byte) 13, Metadata.String(value));
|
super.metadata.setIndex(OFFSET, Metadata.String(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -32,7 +34,7 @@ public class CommandBlockMinecartMeta extends AbstractMinecartMeta {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public Component getLastOutput() {
|
public Component getLastOutput() {
|
||||||
return super.metadata.getIndex((byte) 14, Component.empty());
|
return super.metadata.getIndex(OFFSET + 1, Component.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -44,7 +46,7 @@ public class CommandBlockMinecartMeta extends AbstractMinecartMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setLastOutput(@NotNull Component value) {
|
public void setLastOutput(@NotNull Component value) {
|
||||||
super.metadata.setIndex((byte) 14, Metadata.Chat(value));
|
super.metadata.setIndex(OFFSET + 1, Metadata.Chat(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -5,17 +5,19 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class FurnaceMinecartMeta extends AbstractMinecartMeta {
|
public class FurnaceMinecartMeta extends AbstractMinecartMeta {
|
||||||
|
public static final byte OFFSET = AbstractMinecartMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
public FurnaceMinecartMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public FurnaceMinecartMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHasFuel() {
|
public boolean isHasFuel() {
|
||||||
return super.metadata.getIndex((byte) 13, false);
|
return super.metadata.getIndex(OFFSET, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHasFuel(boolean value) {
|
public void setHasFuel(boolean value) {
|
||||||
super.metadata.setIndex((byte) 13, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -5,6 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class HopperMinecartMeta extends AbstractMinecartContainerMeta {
|
public class HopperMinecartMeta extends AbstractMinecartContainerMeta {
|
||||||
|
public static final byte OFFSET = AbstractMinecartContainerMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public HopperMinecartMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public HopperMinecartMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -5,6 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class MinecartMeta extends AbstractMinecartMeta {
|
public class MinecartMeta extends AbstractMinecartMeta {
|
||||||
|
public static final byte OFFSET = AbstractMinecartMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public MinecartMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public MinecartMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -5,6 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class SpawnerMinecartMeta extends AbstractMinecartMeta {
|
public class SpawnerMinecartMeta extends AbstractMinecartMeta {
|
||||||
|
public static final byte OFFSET = AbstractMinecartMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public SpawnerMinecartMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public SpawnerMinecartMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -5,6 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class TntMinecartMeta extends AbstractMinecartMeta {
|
public class TntMinecartMeta extends AbstractMinecartMeta {
|
||||||
|
public static final byte OFFSET = AbstractMinecartMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public TntMinecartMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public TntMinecartMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -5,17 +5,19 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class BasePiglinMeta extends MonsterMeta {
|
public class BasePiglinMeta extends MonsterMeta {
|
||||||
|
public static final byte OFFSET = MonsterMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
protected BasePiglinMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
protected BasePiglinMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isImmuneToZombification() {
|
public boolean isImmuneToZombification() {
|
||||||
return super.metadata.getIndex((byte) 15, false);
|
return super.metadata.getIndex(OFFSET, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setImmuneToZombification(boolean value) {
|
public void setImmuneToZombification(boolean value) {
|
||||||
super.metadata.setIndex((byte) 15, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class BlazeMeta extends MonsterMeta {
|
public class BlazeMeta extends MonsterMeta {
|
||||||
|
public static final byte OFFSET = MonsterMeta.MAX_OFFSET;
|
||||||
private final static byte MASK_INDEX = 15;
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
private final static byte ON_FIRE_BIT = 0x01;
|
private final static byte ON_FIRE_BIT = 0x01;
|
||||||
|
|
||||||
@ -15,11 +15,11 @@ public class BlazeMeta extends MonsterMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOnFire() {
|
public boolean isOnFire() {
|
||||||
return getMaskBit(MASK_INDEX, ON_FIRE_BIT);
|
return getMaskBit(OFFSET, ON_FIRE_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnFire(boolean value) {
|
public void setOnFire(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, ON_FIRE_BIT, value);
|
setMaskBit(OFFSET, ON_FIRE_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class CaveSpiderMeta extends SpiderMeta {
|
public class CaveSpiderMeta extends SpiderMeta {
|
||||||
|
public static final byte OFFSET = SpiderMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public CaveSpiderMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public CaveSpiderMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -5,6 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class CreeperMeta extends MonsterMeta {
|
public class CreeperMeta extends MonsterMeta {
|
||||||
|
public static final byte OFFSET = MonsterMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 3;
|
||||||
|
|
||||||
public CreeperMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public CreeperMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
@ -12,28 +14,28 @@ public class CreeperMeta extends MonsterMeta {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public State getState() {
|
public State getState() {
|
||||||
int id = super.metadata.getIndex((byte) 15, -1);
|
int id = super.metadata.getIndex(OFFSET, -1);
|
||||||
return id == -1 ? State.IDLE : State.FUSE;
|
return id == -1 ? State.IDLE : State.FUSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setState(@NotNull State value) {
|
public void setState(@NotNull State value) {
|
||||||
super.metadata.setIndex((byte) 15, Metadata.VarInt(value == State.IDLE ? -1 : 1));
|
super.metadata.setIndex(OFFSET, Metadata.VarInt(value == State.IDLE ? -1 : 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCharged() {
|
public boolean isCharged() {
|
||||||
return super.metadata.getIndex((byte) 16, false);
|
return super.metadata.getIndex(OFFSET + 1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCharged(boolean value) {
|
public void setCharged(boolean value) {
|
||||||
super.metadata.setIndex((byte) 16, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET + 1, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isIgnited() {
|
public boolean isIgnited() {
|
||||||
return super.metadata.getIndex((byte) 17, false);
|
return super.metadata.getIndex(OFFSET + 2, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIgnited(boolean value) {
|
public void setIgnited(boolean value) {
|
||||||
super.metadata.setIndex((byte) 17, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET + 2, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum State {
|
public enum State {
|
||||||
|
@ -5,6 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class ElderGuardianMeta extends GuardianMeta {
|
public class ElderGuardianMeta extends GuardianMeta {
|
||||||
|
public static final byte OFFSET = GuardianMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public ElderGuardianMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public ElderGuardianMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -6,33 +6,35 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class EndermanMeta extends MonsterMeta {
|
public class EndermanMeta extends MonsterMeta {
|
||||||
|
public static final byte OFFSET = MonsterMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 3;
|
||||||
|
|
||||||
public EndermanMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public EndermanMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getCarriedBlockID() {
|
public Integer getCarriedBlockID() {
|
||||||
return super.metadata.getIndex((byte) 15, null);
|
return super.metadata.getIndex(OFFSET, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCarriedBlockID(@Nullable Integer value) {
|
public void setCarriedBlockID(@Nullable Integer value) {
|
||||||
super.metadata.setIndex((byte) 15, Metadata.OptBlockID(value));
|
super.metadata.setIndex(OFFSET, Metadata.OptBlockID(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isScreaming() {
|
public boolean isScreaming() {
|
||||||
return super.metadata.getIndex((byte) 16, false);
|
return super.metadata.getIndex(OFFSET + 1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setScreaming(boolean value) {
|
public void setScreaming(boolean value) {
|
||||||
super.metadata.setIndex((byte) 16, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET + 1, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isStaring() {
|
public boolean isStaring() {
|
||||||
return super.metadata.getIndex((byte) 17, false);
|
return super.metadata.getIndex(OFFSET + 2, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStaring(boolean value) {
|
public void setStaring(boolean value) {
|
||||||
super.metadata.setIndex((byte) 17, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET + 2, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class EndermiteMeta extends MonsterMeta {
|
public class EndermiteMeta extends MonsterMeta {
|
||||||
|
public static final byte OFFSET = MonsterMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public EndermiteMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public EndermiteMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -5,6 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class GiantMeta extends MonsterMeta {
|
public class GiantMeta extends MonsterMeta {
|
||||||
|
public static final byte OFFSET = MonsterMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public GiantMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public GiantMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -5,6 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class GuardianMeta extends MonsterMeta {
|
public class GuardianMeta extends MonsterMeta {
|
||||||
|
public static final byte OFFSET = MonsterMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 2;
|
||||||
|
|
||||||
private Entity target;
|
private Entity target;
|
||||||
|
|
||||||
@ -13,11 +15,11 @@ public class GuardianMeta extends MonsterMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRetractingSpikes() {
|
public boolean isRetractingSpikes() {
|
||||||
return super.metadata.getIndex((byte) 15, false);
|
return super.metadata.getIndex(OFFSET, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRetractingSpikes(boolean retractingSpikes) {
|
public void setRetractingSpikes(boolean retractingSpikes) {
|
||||||
super.metadata.setIndex((byte) 15, Metadata.Boolean(retractingSpikes));
|
super.metadata.setIndex(OFFSET, Metadata.Boolean(retractingSpikes));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Entity getTarget() {
|
public Entity getTarget() {
|
||||||
@ -26,7 +28,7 @@ public class GuardianMeta extends MonsterMeta {
|
|||||||
|
|
||||||
public void setTarget(@NotNull Entity target) {
|
public void setTarget(@NotNull Entity target) {
|
||||||
this.target = target;
|
this.target = target;
|
||||||
super.metadata.setIndex((byte) 16, Metadata.VarInt(target.getEntityId()));
|
super.metadata.setIndex(OFFSET + 1, Metadata.VarInt(target.getEntityId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,12 @@ package net.minestom.server.entity.metadata.monster;
|
|||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
import net.minestom.server.entity.metadata.PathfinderMobMeta;
|
import net.minestom.server.entity.metadata.PathfinderMobMeta;
|
||||||
|
import net.minestom.server.entity.metadata.minecart.AbstractMinecartMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class MonsterMeta extends PathfinderMobMeta {
|
public class MonsterMeta extends PathfinderMobMeta {
|
||||||
|
public static final byte OFFSET = PathfinderMobMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
protected MonsterMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
protected MonsterMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -5,6 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class PiglinBruteMeta extends BasePiglinMeta {
|
public class PiglinBruteMeta extends BasePiglinMeta {
|
||||||
|
public static final byte OFFSET = BasePiglinMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public PiglinBruteMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public PiglinBruteMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -6,13 +6,15 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class PiglinMeta extends BasePiglinMeta {
|
public class PiglinMeta extends BasePiglinMeta {
|
||||||
|
public static final byte OFFSET = BasePiglinMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 3;
|
||||||
|
|
||||||
public PiglinMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public PiglinMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBaby() {
|
public boolean isBaby() {
|
||||||
return super.metadata.getIndex((byte) 16, false);
|
return super.metadata.getIndex(OFFSET, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBaby(boolean value) {
|
public void setBaby(boolean value) {
|
||||||
@ -25,23 +27,23 @@ public class PiglinMeta extends BasePiglinMeta {
|
|||||||
} else {
|
} else {
|
||||||
setBoundingBox(bb.getWidth() * 2, bb.getHeight() * 2);
|
setBoundingBox(bb.getWidth() * 2, bb.getHeight() * 2);
|
||||||
}
|
}
|
||||||
super.metadata.setIndex((byte) 16, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isChargingCrossbow() {
|
public boolean isChargingCrossbow() {
|
||||||
return super.metadata.getIndex((byte) 17, false);
|
return super.metadata.getIndex(OFFSET + 1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChargingCrossbow(boolean value) {
|
public void setChargingCrossbow(boolean value) {
|
||||||
super.metadata.setIndex((byte) 17, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET + 1, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDancing() {
|
public boolean isDancing() {
|
||||||
return super.metadata.getIndex((byte) 18, false);
|
return super.metadata.getIndex(OFFSET + 2, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDancing(boolean value) {
|
public void setDancing(boolean value) {
|
||||||
super.metadata.setIndex((byte) 18, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET + 2, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class SilverfishMeta extends MonsterMeta {
|
public class SilverfishMeta extends MonsterMeta {
|
||||||
|
public static final byte OFFSET = MonsterMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public SilverfishMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public SilverfishMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -5,8 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class SpiderMeta extends MonsterMeta {
|
public class SpiderMeta extends MonsterMeta {
|
||||||
|
public static final byte OFFSET = MonsterMeta.MAX_OFFSET;
|
||||||
private final static byte MASK_INDEX = 15;
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
private final static byte CLIMBING_BIT = 0x01;
|
private final static byte CLIMBING_BIT = 0x01;
|
||||||
|
|
||||||
@ -15,11 +15,11 @@ public class SpiderMeta extends MonsterMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isClimbing() {
|
public boolean isClimbing() {
|
||||||
return getMaskBit(MASK_INDEX, CLIMBING_BIT);
|
return getMaskBit(OFFSET, CLIMBING_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClimbing(boolean value) {
|
public void setClimbing(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, CLIMBING_BIT, value);
|
setMaskBit(OFFSET, CLIMBING_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class VexMeta extends MonsterMeta {
|
public class VexMeta extends MonsterMeta {
|
||||||
|
public static final byte OFFSET = MonsterMeta.MAX_OFFSET;
|
||||||
private final static byte MASK_INDEX = 15;
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
private final static byte ATTACKING_BIT = 0x01;
|
private final static byte ATTACKING_BIT = 0x01;
|
||||||
|
|
||||||
@ -15,11 +15,11 @@ public class VexMeta extends MonsterMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAttacking() {
|
public boolean isAttacking() {
|
||||||
return getMaskBit(MASK_INDEX, ATTACKING_BIT);
|
return getMaskBit(OFFSET, ATTACKING_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAttacking(boolean value) {
|
public void setAttacking(boolean value) {
|
||||||
setMaskBit(MASK_INDEX, ATTACKING_BIT, value);
|
setMaskBit(OFFSET, ATTACKING_BIT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class WitherMeta extends MonsterMeta {
|
public class WitherMeta extends MonsterMeta {
|
||||||
|
public static final byte OFFSET = MonsterMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 4;
|
||||||
|
|
||||||
private Entity centerHead;
|
private Entity centerHead;
|
||||||
private Entity leftHead;
|
private Entity leftHead;
|
||||||
@ -22,7 +24,7 @@ public class WitherMeta extends MonsterMeta {
|
|||||||
|
|
||||||
public void setCenterHead(@Nullable Entity value) {
|
public void setCenterHead(@Nullable Entity value) {
|
||||||
this.centerHead = value;
|
this.centerHead = value;
|
||||||
super.metadata.setIndex((byte) 15, Metadata.VarInt(value == null ? 0 : value.getEntityId()));
|
super.metadata.setIndex(OFFSET, Metadata.VarInt(value == null ? 0 : value.getEntityId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@ -32,7 +34,7 @@ public class WitherMeta extends MonsterMeta {
|
|||||||
|
|
||||||
public void setLeftHead(@Nullable Entity value) {
|
public void setLeftHead(@Nullable Entity value) {
|
||||||
this.leftHead = value;
|
this.leftHead = value;
|
||||||
super.metadata.setIndex((byte) 16, Metadata.VarInt(value == null ? 0 : value.getEntityId()));
|
super.metadata.setIndex(OFFSET + 1, Metadata.VarInt(value == null ? 0 : value.getEntityId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@ -42,15 +44,15 @@ public class WitherMeta extends MonsterMeta {
|
|||||||
|
|
||||||
public void setRightHead(@Nullable Entity value) {
|
public void setRightHead(@Nullable Entity value) {
|
||||||
this.rightHead = value;
|
this.rightHead = value;
|
||||||
super.metadata.setIndex((byte) 17, Metadata.VarInt(value == null ? 0 : value.getEntityId()));
|
super.metadata.setIndex(OFFSET + 2, Metadata.VarInt(value == null ? 0 : value.getEntityId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInvulnerableTime() {
|
public int getInvulnerableTime() {
|
||||||
return super.metadata.getIndex((byte) 18, 0);
|
return super.metadata.getIndex(OFFSET + 3, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInvulnerableTime(int value) {
|
public void setInvulnerableTime(int value) {
|
||||||
super.metadata.setIndex((byte) 18, Metadata.VarInt(value));
|
super.metadata.setIndex(OFFSET + 3, Metadata.VarInt(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,13 +6,15 @@ import net.minestom.server.entity.Metadata;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class ZoglinMeta extends MonsterMeta {
|
public class ZoglinMeta extends MonsterMeta {
|
||||||
|
public static final byte OFFSET = MonsterMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
public ZoglinMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public ZoglinMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBaby() {
|
public boolean isBaby() {
|
||||||
return super.metadata.getIndex((byte) 15, false);
|
return super.metadata.getIndex(OFFSET, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBaby(boolean value) {
|
public void setBaby(boolean value) {
|
||||||
@ -25,7 +27,7 @@ public class ZoglinMeta extends MonsterMeta {
|
|||||||
} else {
|
} else {
|
||||||
setBoundingBox(bb.getWidth() * 2, bb.getHeight() * 2);
|
setBoundingBox(bb.getWidth() * 2, bb.getHeight() * 2);
|
||||||
}
|
}
|
||||||
super.metadata.setIndex((byte) 15, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,12 @@ package net.minestom.server.entity.metadata.monster.raider;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.monster.MonsterMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class AbstractIllagerMeta extends RaiderMeta {
|
public class AbstractIllagerMeta extends RaiderMeta {
|
||||||
|
public static final byte OFFSET = RaiderMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
protected AbstractIllagerMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
protected AbstractIllagerMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -2,9 +2,12 @@ package net.minestom.server.entity.metadata.monster.raider;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.monster.MonsterMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class EvokerMeta extends SpellcasterIllagerMeta {
|
public class EvokerMeta extends SpellcasterIllagerMeta {
|
||||||
|
public static final byte OFFSET = SpellcasterIllagerMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public EvokerMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public EvokerMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -2,9 +2,12 @@ package net.minestom.server.entity.metadata.monster.raider;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.monster.MonsterMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class IllusionerMeta extends SpellcasterIllagerMeta {
|
public class IllusionerMeta extends SpellcasterIllagerMeta {
|
||||||
|
public static final byte OFFSET = SpellcasterIllagerMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public IllusionerMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public IllusionerMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -2,9 +2,12 @@ package net.minestom.server.entity.metadata.monster.raider;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.monster.MonsterMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class PillagerMeta extends AbstractIllagerMeta {
|
public class PillagerMeta extends AbstractIllagerMeta {
|
||||||
|
public static final byte OFFSET = AbstractIllagerMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public PillagerMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public PillagerMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -6,17 +6,19 @@ import net.minestom.server.entity.metadata.monster.MonsterMeta;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class RaiderMeta extends MonsterMeta {
|
public class RaiderMeta extends MonsterMeta {
|
||||||
|
public static final byte OFFSET = MonsterMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
protected RaiderMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
protected RaiderMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCelebrating() {
|
public boolean isCelebrating() {
|
||||||
return super.metadata.getIndex((byte) 15, false);
|
return super.metadata.getIndex(OFFSET, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCelebrating(boolean value) {
|
public void setCelebrating(boolean value) {
|
||||||
super.metadata.setIndex((byte) 15, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,12 @@ package net.minestom.server.entity.metadata.monster.raider;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.monster.MonsterMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class RavagerMeta extends RaiderMeta {
|
public class RavagerMeta extends RaiderMeta {
|
||||||
|
public static final byte OFFSET = RaiderMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public RavagerMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public RavagerMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -2,9 +2,12 @@ package net.minestom.server.entity.metadata.monster.raider;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.monster.MonsterMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class SpellcasterIllagerMeta extends AbstractIllagerMeta {
|
public class SpellcasterIllagerMeta extends AbstractIllagerMeta {
|
||||||
|
public static final byte OFFSET = AbstractIllagerMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
protected SpellcasterIllagerMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
protected SpellcasterIllagerMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
@ -12,11 +15,11 @@ public class SpellcasterIllagerMeta extends AbstractIllagerMeta {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public Spell getSpell() {
|
public Spell getSpell() {
|
||||||
return Spell.VALUES[super.metadata.getIndex((byte) 16, (byte) 0)];
|
return Spell.VALUES[super.metadata.getIndex(OFFSET, (byte) 0)];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSpell(@NotNull Spell spell) {
|
public void setSpell(@NotNull Spell spell) {
|
||||||
super.metadata.setIndex((byte) 16, Metadata.Byte((byte) spell.ordinal()));
|
super.metadata.setIndex(OFFSET, Metadata.Byte((byte) spell.ordinal()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Spell {
|
public enum Spell {
|
||||||
|
@ -2,9 +2,12 @@ package net.minestom.server.entity.metadata.monster.raider;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.monster.MonsterMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class VindicatorMeta extends AbstractIllagerMeta {
|
public class VindicatorMeta extends AbstractIllagerMeta {
|
||||||
|
public static final byte OFFSET = AbstractIllagerMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public VindicatorMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public VindicatorMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -2,20 +2,23 @@ package net.minestom.server.entity.metadata.monster.raider;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.monster.MonsterMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class WitchMeta extends RaiderMeta {
|
public class WitchMeta extends RaiderMeta {
|
||||||
|
public static final byte OFFSET = RaiderMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||||
|
|
||||||
public WitchMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public WitchMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDrinkingPotion() {
|
public boolean isDrinkingPotion() {
|
||||||
return super.metadata.getIndex((byte) 16, false);
|
return super.metadata.getIndex(OFFSET, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDrinkingPotion(boolean value) {
|
public void setDrinkingPotion(boolean value) {
|
||||||
super.metadata.setIndex((byte) 16, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@ import net.minestom.server.entity.metadata.monster.MonsterMeta;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class AbstractSkeletonMeta extends MonsterMeta {
|
public class AbstractSkeletonMeta extends MonsterMeta {
|
||||||
|
public static final byte OFFSET = MonsterMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
protected AbstractSkeletonMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
protected AbstractSkeletonMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -2,9 +2,12 @@ package net.minestom.server.entity.metadata.monster.skeleton;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.monster.MonsterMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class SkeletonMeta extends AbstractSkeletonMeta {
|
public class SkeletonMeta extends AbstractSkeletonMeta {
|
||||||
|
public static final byte OFFSET = AbstractSkeletonMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public SkeletonMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public SkeletonMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -2,9 +2,12 @@ package net.minestom.server.entity.metadata.monster.skeleton;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.monster.MonsterMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class StrayMeta extends AbstractSkeletonMeta {
|
public class StrayMeta extends AbstractSkeletonMeta {
|
||||||
|
public static final byte OFFSET = AbstractSkeletonMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public StrayMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public StrayMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -2,9 +2,12 @@ package net.minestom.server.entity.metadata.monster.skeleton;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.monster.MonsterMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class WitherSkeletonMeta extends AbstractSkeletonMeta {
|
public class WitherSkeletonMeta extends AbstractSkeletonMeta {
|
||||||
|
public static final byte OFFSET = AbstractSkeletonMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public WitherSkeletonMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public WitherSkeletonMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -2,9 +2,12 @@ package net.minestom.server.entity.metadata.monster.zombie;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.monster.MonsterMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class DrownedMeta extends ZombieMeta {
|
public class DrownedMeta extends ZombieMeta {
|
||||||
|
public static final byte OFFSET = ZombieMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public DrownedMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public DrownedMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -2,9 +2,12 @@ package net.minestom.server.entity.metadata.monster.zombie;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.monster.MonsterMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class HuskMeta extends ZombieMeta {
|
public class HuskMeta extends ZombieMeta {
|
||||||
|
public static final byte OFFSET = ZombieMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 0;
|
||||||
|
|
||||||
public HuskMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public HuskMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
|
@ -7,13 +7,15 @@ import net.minestom.server.entity.metadata.monster.MonsterMeta;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class ZombieMeta extends MonsterMeta {
|
public class ZombieMeta extends MonsterMeta {
|
||||||
|
public static final byte OFFSET = MonsterMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 3;
|
||||||
|
|
||||||
public ZombieMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public ZombieMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBaby() {
|
public boolean isBaby() {
|
||||||
return super.metadata.getIndex((byte) 15, false);
|
return super.metadata.getIndex(OFFSET, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBaby(boolean value) {
|
public void setBaby(boolean value) {
|
||||||
@ -26,15 +28,15 @@ public class ZombieMeta extends MonsterMeta {
|
|||||||
} else {
|
} else {
|
||||||
setBoundingBox(bb.getWidth() * 2, bb.getHeight() * 2);
|
setBoundingBox(bb.getWidth() * 2, bb.getHeight() * 2);
|
||||||
}
|
}
|
||||||
super.metadata.setIndex((byte) 15, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBecomingDrowned() {
|
public boolean isBecomingDrowned() {
|
||||||
return super.metadata.getIndex((byte) 17, false);
|
return super.metadata.getIndex(OFFSET + 2, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBecomingDrowned(boolean value) {
|
public void setBecomingDrowned(boolean value) {
|
||||||
super.metadata.setIndex((byte) 17, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET + 2, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,25 +2,28 @@ package net.minestom.server.entity.metadata.monster.zombie;
|
|||||||
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
|
import net.minestom.server.entity.metadata.monster.MonsterMeta;
|
||||||
import net.minestom.server.entity.metadata.villager.VillagerMeta;
|
import net.minestom.server.entity.metadata.villager.VillagerMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class ZombieVillagerMeta extends ZombieMeta {
|
public class ZombieVillagerMeta extends ZombieMeta {
|
||||||
|
public static final byte OFFSET = ZombieMeta.MAX_OFFSET;
|
||||||
|
public static final byte MAX_OFFSET = OFFSET + 2;
|
||||||
|
|
||||||
public ZombieVillagerMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
public ZombieVillagerMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||||
super(entity, metadata);
|
super(entity, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isConverting() {
|
public boolean isConverting() {
|
||||||
return super.metadata.getIndex((byte) 18, false);
|
return super.metadata.getIndex(OFFSET, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConverting(boolean value) {
|
public void setConverting(boolean value) {
|
||||||
super.metadata.setIndex((byte) 18, Metadata.Boolean(value));
|
super.metadata.setIndex(OFFSET, Metadata.Boolean(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public VillagerMeta.VillagerData getVillagerData() {
|
public VillagerMeta.VillagerData getVillagerData() {
|
||||||
int[] data = super.metadata.getIndex((byte) 17, null);
|
int[] data = super.metadata.getIndex(OFFSET + 1, null);
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
return new VillagerMeta.VillagerData(VillagerMeta.Type.PLAINS, VillagerMeta.Profession.NONE, VillagerMeta.Level.NOVICE);
|
return new VillagerMeta.VillagerData(VillagerMeta.Type.PLAINS, VillagerMeta.Profession.NONE, VillagerMeta.Level.NOVICE);
|
||||||
}
|
}
|
||||||
@ -28,7 +31,7 @@ public class ZombieVillagerMeta extends ZombieMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setVillagerData(VillagerMeta.VillagerData data) {
|
public void setVillagerData(VillagerMeta.VillagerData data) {
|
||||||
super.metadata.setIndex((byte) 17, Metadata.VillagerData(
|
super.metadata.setIndex(OFFSET + 1, Metadata.VillagerData(
|
||||||
data.getType().ordinal(),
|
data.getType().ordinal(),
|
||||||
data.getProfession().ordinal(),
|
data.getProfession().ordinal(),
|
||||||
data.getLevel().ordinal() + 1
|
data.getLevel().ordinal() + 1
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user