Add blockdata as a valid falling block thing, requires setblockdata
This commit is contained in:
parent
f322a80b69
commit
4f0290218b
@ -17,13 +17,13 @@ public enum DisguiseType {
|
||||
|
||||
BAT,
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_15) BEE,
|
||||
@NmsAddedIn(value = NmsVersion.v1_15) BEE,
|
||||
|
||||
BLAZE,
|
||||
|
||||
BOAT(1),
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14) CAT,
|
||||
@NmsAddedIn(value = NmsVersion.v1_14) CAT,
|
||||
|
||||
CAVE_SPIDER,
|
||||
|
||||
@ -75,7 +75,7 @@ public enum DisguiseType {
|
||||
|
||||
FISHING_HOOK(90),
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14) FOX,
|
||||
@NmsAddedIn(value = NmsVersion.v1_14) FOX,
|
||||
|
||||
GHAST,
|
||||
|
||||
@ -83,7 +83,7 @@ public enum DisguiseType {
|
||||
|
||||
GUARDIAN,
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_16) HOGLIN,
|
||||
@NmsAddedIn(value = NmsVersion.v1_16) HOGLIN,
|
||||
|
||||
HORSE,
|
||||
|
||||
@ -129,7 +129,7 @@ public enum DisguiseType {
|
||||
|
||||
PAINTING,
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14) PANDA,
|
||||
@NmsAddedIn(value = NmsVersion.v1_14) PANDA,
|
||||
|
||||
PARROT,
|
||||
|
||||
@ -139,9 +139,9 @@ public enum DisguiseType {
|
||||
|
||||
@NmsRemovedIn(val = NmsVersion.v1_16) PIG_ZOMBIE,
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_16) PIGLIN,
|
||||
@NmsAddedIn(value = NmsVersion.v1_16) PIGLIN,
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14) PILLAGER,
|
||||
@NmsAddedIn(value = NmsVersion.v1_14) PILLAGER,
|
||||
|
||||
PLAYER,
|
||||
|
||||
@ -153,7 +153,7 @@ public enum DisguiseType {
|
||||
|
||||
RABBIT,
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14) RAVAGER,
|
||||
@NmsAddedIn(value = NmsVersion.v1_14) RAVAGER,
|
||||
|
||||
SALMON,
|
||||
|
||||
@ -187,7 +187,7 @@ public enum DisguiseType {
|
||||
|
||||
STRAY,
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_16) STRIDER,
|
||||
@NmsAddedIn(value = NmsVersion.v1_16) STRIDER,
|
||||
|
||||
THROWN_EXP_BOTTLE(75),
|
||||
|
||||
@ -195,7 +195,7 @@ public enum DisguiseType {
|
||||
|
||||
TRIDENT(94, 0),
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14) TRADER_LLAMA,
|
||||
@NmsAddedIn(value = NmsVersion.v1_14) TRADER_LLAMA,
|
||||
|
||||
TROPICAL_FISH,
|
||||
|
||||
@ -209,7 +209,7 @@ public enum DisguiseType {
|
||||
|
||||
VINDICATOR,
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14) WANDERING_TRADER,
|
||||
@NmsAddedIn(value = NmsVersion.v1_14) WANDERING_TRADER,
|
||||
|
||||
WITCH,
|
||||
|
||||
@ -221,7 +221,7 @@ public enum DisguiseType {
|
||||
|
||||
WOLF,
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_16) ZOGLIN,
|
||||
@NmsAddedIn(value = NmsVersion.v1_16) ZOGLIN,
|
||||
|
||||
ZOMBIE,
|
||||
|
||||
@ -229,7 +229,7 @@ public enum DisguiseType {
|
||||
|
||||
ZOMBIE_VILLAGER,
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_16) ZOMBIFIED_PIGLIN;
|
||||
@NmsAddedIn(value = NmsVersion.v1_16) ZOMBIFIED_PIGLIN;
|
||||
|
||||
public static DisguiseType getType(Entity entity) {
|
||||
DisguiseType disguiseType = getType(entity.getType());
|
||||
|
@ -282,12 +282,12 @@ public class FlagWatcher {
|
||||
updateNameHeight();
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public EntityPose getEntityPose() {
|
||||
return getData(MetaIndex.ENTITY_POSE);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public void setEntityPose(EntityPose entityPose) {
|
||||
setData(MetaIndex.ENTITY_POSE, entityPose);
|
||||
sendData(MetaIndex.ENTITY_POSE);
|
||||
@ -760,12 +760,12 @@ public class FlagWatcher {
|
||||
}
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public boolean isSleeping() {
|
||||
return sleeping;
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public void setSleeping(boolean sleeping) {
|
||||
if (isSleeping() == sleeping) {
|
||||
return;
|
||||
@ -776,12 +776,12 @@ public class FlagWatcher {
|
||||
updatePose();
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public boolean isSwimming() {
|
||||
return getEntityFlag(4);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public void setSwimming(boolean swimming) {
|
||||
if (isSwimming() == swimming) {
|
||||
return;
|
||||
@ -792,7 +792,7 @@ public class FlagWatcher {
|
||||
updatePose();
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
protected void updatePose() {
|
||||
if (isSleeping()) {
|
||||
setEntityPose(EntityPose.SLEEPING);
|
||||
|
@ -45,7 +45,7 @@ public class MetaIndex<Y> {
|
||||
/**
|
||||
* The type of particle to display
|
||||
*/
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
@NmsAddedIn(value = NmsVersion.v1_13)
|
||||
public static MetaIndex<WrappedParticle> AREA_EFFECT_PARTICLE = new MetaIndex<>(AreaEffectCloudWatcher.class, 3,
|
||||
NmsVersion.v1_13.isSupported() ? WrappedParticle.create(Particle.SPELL_MOB, null) : null);
|
||||
|
||||
@ -114,11 +114,11 @@ public class MetaIndex<Y> {
|
||||
/**
|
||||
* The shooter of the arrow, no visible effect if set
|
||||
*/
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
@NmsAddedIn(value = NmsVersion.v1_13)
|
||||
@NmsRemovedIn(val = NmsVersion.v1_16)
|
||||
public static MetaIndex<Optional<UUID>> ARROW_UUID = new MetaIndex<>(ArrowWatcher.class, 1, Optional.empty());
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<Byte> ARROW_PIERCE_LEVEL = new MetaIndex<>(ArrowWatcher.class, 2, (byte) 0);
|
||||
|
||||
/**
|
||||
@ -126,10 +126,10 @@ public class MetaIndex<Y> {
|
||||
*/
|
||||
public static MetaIndex<Byte> BAT_HANGING = new MetaIndex<>(BatWatcher.class, 0, (byte) 1);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_15)
|
||||
@NmsAddedIn(value = NmsVersion.v1_15)
|
||||
public static MetaIndex<Byte> BEE_META = new MetaIndex<>(BeeWatcher.class, 0, (byte) 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_15)
|
||||
@NmsAddedIn(value = NmsVersion.v1_15)
|
||||
public static MetaIndex<Integer> BEE_ANGER = new MetaIndex<>(BeeWatcher.class, 1, 0);
|
||||
|
||||
/**
|
||||
@ -155,19 +155,19 @@ public class MetaIndex<Y> {
|
||||
*/
|
||||
public static MetaIndex<Integer> BOAT_TYPE = new MetaIndex<>(BoatWatcher.class, 3, 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
@NmsAddedIn(value = NmsVersion.v1_13)
|
||||
public static MetaIndex<Integer> BOAT_SHAKE = new MetaIndex<>(BoatWatcher.class, 6, 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<Integer> CAT_TYPE = new MetaIndex<>(CatWatcher.class, 0, 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<Boolean> CAT_LYING_DOWN = new MetaIndex<>(CatWatcher.class, 1, false);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<Boolean> CAT_LOOKING_UP = new MetaIndex<>(CatWatcher.class, 2, false);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<Integer> CAT_COLLAR = new MetaIndex<>(CatWatcher.class, 3, AnimalColor.RED.ordinal());
|
||||
|
||||
/**
|
||||
@ -216,7 +216,7 @@ public class MetaIndex<Y> {
|
||||
|
||||
public static MetaIndex<Integer> ENDER_DRAGON_PHASE = new MetaIndex<>(EnderDragonWatcher.class, 0, 10);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<ItemStack> ENDER_SIGNAL_ITEM = new MetaIndex<>(EnderSignalWatcher.class, 0,
|
||||
new ItemStack(Material.AIR));
|
||||
|
||||
@ -225,7 +225,7 @@ public class MetaIndex<Y> {
|
||||
*/
|
||||
public static MetaIndex<Boolean> ENDERMAN_AGRESSIVE = new MetaIndex<>(EndermanWatcher.class, 1, false);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_15)
|
||||
@NmsAddedIn(value = NmsVersion.v1_15)
|
||||
public static MetaIndex<Boolean> ENDERMAN_UNKNOWN = new MetaIndex<>(EndermanWatcher.class, 2, false);
|
||||
|
||||
/**
|
||||
@ -239,7 +239,7 @@ public class MetaIndex<Y> {
|
||||
/**
|
||||
* The custom name of the entity, empty if not set
|
||||
*/
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
@NmsAddedIn(value = NmsVersion.v1_13)
|
||||
public static MetaIndex<Optional<WrappedChatComponent>> ENTITY_CUSTOM_NAME = new MetaIndex<>(FlagWatcher.class, 2,
|
||||
Optional.empty());
|
||||
/**
|
||||
@ -272,13 +272,13 @@ public class MetaIndex<Y> {
|
||||
* If entity can make sounds, no noticable effects
|
||||
*/
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<EntityPose> ENTITY_POSE = new MetaIndex<>(FlagWatcher.class, 6, EntityPose.STANDING);
|
||||
|
||||
public static MetaIndex<BlockPosition> FALLING_BLOCK_POSITION = new MetaIndex<>(FallingBlockWatcher.class, 0,
|
||||
BlockPosition.ORIGIN);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<ItemStack> FIREBALL_ITEM = new MetaIndex<>(FireballWatcher.class, 0,
|
||||
new ItemStack(Material.AIR));
|
||||
|
||||
@ -290,31 +290,31 @@ public class MetaIndex<Y> {
|
||||
@NmsRemovedIn(val = NmsVersion.v1_14)
|
||||
public static MetaIndex<Integer> FIREWORK_ATTACHED_ENTITY_OLD = new MetaIndex<>(FireworkWatcher.class, 1, 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<OptionalInt> FIREWORK_ATTACHED_ENTITY = new MetaIndex<>(FireworkWatcher.class, 1,
|
||||
OptionalInt.empty());
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<Boolean> FIREWORK_SHOT_AT_ANGLE = new MetaIndex<>(FireworkWatcher.class, 2, false);
|
||||
|
||||
public static MetaIndex<Integer> FISHING_HOOK_HOOKED_ID = new MetaIndex<>(FishingHookWatcher.class, 0, 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_16)
|
||||
@NmsAddedIn(value = NmsVersion.v1_16)
|
||||
public static MetaIndex<Boolean> FISHING_HOOK_HOOKED = new MetaIndex<>(FishingHookWatcher.class, 1, false);
|
||||
|
||||
/**
|
||||
* The type of fox, its coloring
|
||||
*/
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<Integer> FOX_TYPE = new MetaIndex<>(FoxWatcher.class, 0, 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<Byte> FOX_META = new MetaIndex<>(FoxWatcher.class, 1, (byte) 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<Optional<UUID>> FOX_TRUSTED_1 = new MetaIndex<>(FoxWatcher.class, 2, Optional.empty());
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<Optional<UUID>> FOX_TRUSTED_2 = new MetaIndex<>(FoxWatcher.class, 3, Optional.empty());
|
||||
|
||||
/**
|
||||
@ -332,7 +332,7 @@ public class MetaIndex<Y> {
|
||||
*/
|
||||
public static MetaIndex<Integer> GUARDIAN_TARGET = new MetaIndex<>(GuardianWatcher.class, 1, 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_16)
|
||||
@NmsAddedIn(value = NmsVersion.v1_16)
|
||||
public static MetaIndex<Boolean> HOGLIN_SHAKING = new MetaIndex<>(HoglinWatcher.class, 0, false);
|
||||
|
||||
/**
|
||||
@ -359,7 +359,7 @@ public class MetaIndex<Y> {
|
||||
public static MetaIndex<Optional<UUID>> HORSE_OWNER = new MetaIndex<>(AbstractHorseWatcher.class, 1,
|
||||
Optional.empty());
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<Byte> ILLAGER_SPELL = new MetaIndex<>(IllagerWizardWatcher.class, 0, (byte) 0);
|
||||
|
||||
@NmsRemovedIn(val = NmsVersion.v1_14)
|
||||
@ -411,10 +411,10 @@ public class MetaIndex<Y> {
|
||||
/**
|
||||
* How many bee stings does the entity have
|
||||
*/
|
||||
@NmsAddedIn(val = NmsVersion.v1_15)
|
||||
@NmsAddedIn(value = NmsVersion.v1_15)
|
||||
public static MetaIndex<Integer> LIVING_STINGS = new MetaIndex<>(LivingWatcher.class, 5, 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<Optional<BlockPosition>> LIVING_BED_POSITION = new MetaIndex<>(LivingWatcher.class, 6,
|
||||
Optional.empty());
|
||||
|
||||
@ -464,31 +464,31 @@ public class MetaIndex<Y> {
|
||||
*/
|
||||
public static MetaIndex<Boolean> MINECART_FURANCE_FUELED = new MetaIndex<>(MinecartFurnaceWatcher.class, 0, false);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<String> MUSHROOM_COW_TYPE = new MetaIndex<>(MushroomCowWatcher.class, 0, "RED");
|
||||
|
||||
@NmsRemovedIn(val = NmsVersion.v1_14)
|
||||
public static MetaIndex<Integer> OCELOT_TYPE = new MetaIndex<>(OcelotWatcher.class, 0, 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<Boolean> OCELOT_TRUST = new MetaIndex<>(OcelotWatcher.class, 0, false);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<Integer> PANDA_HEAD_SHAKING = new MetaIndex<>(PandaWatcher.class, 0, 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<Integer> PANDA_UNKNOWN_1 = new MetaIndex<>(PandaWatcher.class, 1, 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<Integer> PANDA_UNKNOWN_2 = new MetaIndex<>(PandaWatcher.class, 2, 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<Byte> PANDA_MAIN_GENE = new MetaIndex<>(PandaWatcher.class, 3, (byte) 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<Byte> PANDA_HIDDEN_GENE = new MetaIndex<>(PandaWatcher.class, 4, (byte) 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<Byte> PANDA_META = new MetaIndex<>(PandaWatcher.class, 5, (byte) 0);
|
||||
|
||||
public static MetaIndex<Integer> PARROT_VARIANT = new MetaIndex<>(ParrotWatcher.class, 0, 0);
|
||||
@ -502,19 +502,19 @@ public class MetaIndex<Y> {
|
||||
*/
|
||||
public static MetaIndex<Integer> PIG_BOOST = new MetaIndex<>(PigWatcher.class, 1, 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_16)
|
||||
@NmsAddedIn(value = NmsVersion.v1_16)
|
||||
public static MetaIndex<Boolean> PIGLIN_BABY = new MetaIndex<>(PiglinWatcher.class, 0, false);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_16)
|
||||
@NmsAddedIn(value = NmsVersion.v1_16)
|
||||
public static MetaIndex<Boolean> PIGLIN_SHAKING = new MetaIndex<>(PiglinWatcher.class, 1, false);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_16)
|
||||
@NmsAddedIn(value = NmsVersion.v1_16)
|
||||
public static MetaIndex<Boolean> PIGLIN_CROSSBOW = new MetaIndex<>(PiglinWatcher.class, 2, false);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_16)
|
||||
@NmsAddedIn(value = NmsVersion.v1_16)
|
||||
public static MetaIndex<Boolean> PIGLIN_DANCING = new MetaIndex<>(PiglinWatcher.class, 3, false);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<Boolean> PILLAGER_AIMING_BOW = new MetaIndex<>(PillagerWatcher.class, 0, false);
|
||||
|
||||
public static MetaIndex<Float> PLAYER_ABSORPTION = new MetaIndex<>(PlayerWatcher.class, 0, 0F);
|
||||
@ -537,7 +537,7 @@ public class MetaIndex<Y> {
|
||||
|
||||
public static MetaIndex<Integer> RABBIT_TYPE = new MetaIndex<>(RabbitWatcher.class, 0, 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<Boolean> RAIDER_CASTING_SPELL = new MetaIndex<>(RaiderWatcher.class, 0, false);
|
||||
|
||||
public static MetaIndex<Byte> SHEEP_WOOL = new MetaIndex<>(SheepWatcher.class, 0, (byte) 0);
|
||||
@ -558,13 +558,13 @@ public class MetaIndex<Y> {
|
||||
|
||||
public static MetaIndex<Byte> SNOWMAN_DERP = new MetaIndex<>(SnowmanWatcher.class, 0, (byte) 16);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_16)
|
||||
@NmsAddedIn(value = NmsVersion.v1_16)
|
||||
public static MetaIndex<Integer> STRIDER_SADDLE_UNKNOWN = new MetaIndex<>(StriderWatcher.class, 0, 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_16)
|
||||
@NmsAddedIn(value = NmsVersion.v1_16)
|
||||
public static MetaIndex<Boolean> STRIDER_WARM = new MetaIndex<>(StriderWatcher.class, 1, false);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_16)
|
||||
@NmsAddedIn(value = NmsVersion.v1_16)
|
||||
public static MetaIndex<Boolean> STRIDER_SADDLED = new MetaIndex<>(StriderWatcher.class, 2, false);
|
||||
|
||||
public static MetaIndex<Byte> SPIDER_CLIMB = new MetaIndex<>(SpiderWatcher.class, 0, (byte) 0);
|
||||
@ -577,7 +577,7 @@ public class MetaIndex<Y> {
|
||||
public static MetaIndex<Optional<UUID>> TAMEABLE_OWNER = new MetaIndex<>(TameableWatcher.class, 1,
|
||||
Optional.empty());
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<ItemStack> THROWABLE_ITEM = new MetaIndex<>(ThrowableWatcher.class, 0,
|
||||
new ItemStack(Material.AIR));
|
||||
|
||||
@ -587,7 +587,7 @@ public class MetaIndex<Y> {
|
||||
|
||||
public static MetaIndex<Byte> TRIDENT_ENCHANTS = new MetaIndex<>(TridentWatcher.class, 0, (byte) 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_15)
|
||||
@NmsAddedIn(value = NmsVersion.v1_15)
|
||||
public static MetaIndex<Boolean> TRIDENT_ENCHANTED = new MetaIndex<>(TridentWatcher.class, 1, false);
|
||||
|
||||
public static MetaIndex<Integer> TROPICAL_FISH_VARIANT = new MetaIndex<>(TropicalFishWatcher.class, 0, 0);
|
||||
@ -611,10 +611,10 @@ public class MetaIndex<Y> {
|
||||
@NmsRemovedIn(val = NmsVersion.v1_14)
|
||||
public static MetaIndex<Integer> VILLAGER_PROFESSION = new MetaIndex<>(VillagerWatcher.class, 0, 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<Integer> ABSTRACT_VILLAGER_ANGRY = new MetaIndex<>(AbstractVillagerWatcher.class, 0, 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<VillagerData> VILLAGER_DATA = new MetaIndex<>(VillagerWatcher.class, 0,
|
||||
NmsVersion.v1_14.isSupported() ? new VillagerData(Villager.Type.PLAINS, Villager.Profession.NONE, 1) :
|
||||
null);
|
||||
@ -638,10 +638,10 @@ public class MetaIndex<Y> {
|
||||
|
||||
public static MetaIndex<Integer> WOLF_COLLAR = new MetaIndex<>(WolfWatcher.class, 2, 14);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_16)
|
||||
@NmsAddedIn(value = NmsVersion.v1_16)
|
||||
public static MetaIndex<Integer> WOLF_ANGER = new MetaIndex<>(WolfWatcher.class, 3, 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_16)
|
||||
@NmsAddedIn(value = NmsVersion.v1_16)
|
||||
public static MetaIndex<Boolean> ZOGLIN_BABY = new MetaIndex<>(ZoglinWatcher.class, 0, false);
|
||||
|
||||
@NmsRemovedIn(val = NmsVersion.v1_14)
|
||||
@ -649,7 +649,7 @@ public class MetaIndex<Y> {
|
||||
|
||||
public static MetaIndex<Boolean> ZOMBIE_BABY = new MetaIndex<>(ZombieWatcher.class, 0, false);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
@NmsAddedIn(value = NmsVersion.v1_13)
|
||||
public static MetaIndex<Boolean> ZOMBIE_CONVERTING_DROWNED = new MetaIndex<>(ZombieWatcher.class, 2, false);
|
||||
|
||||
public static MetaIndex<Integer> ZOMBIE_PLACEHOLDER = new MetaIndex<>(ZombieWatcher.class, 1, 0);
|
||||
@ -658,7 +658,7 @@ public class MetaIndex<Y> {
|
||||
public static MetaIndex<Integer> ZOMBIE_VILLAGER_PROFESSION_OLD = new MetaIndex<>(ZombieVillagerWatcher.class, 1,
|
||||
0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public static MetaIndex<VillagerData> ZOMBIE_VILLAGER_PROFESSION = new MetaIndex<>(ZombieVillagerWatcher.class, 1,
|
||||
NmsVersion.v1_14.isSupported() ? new VillagerData(Villager.Type.PLAINS, Villager.Profession.NONE, 1) :
|
||||
null);
|
||||
|
@ -13,17 +13,17 @@ public class AbstractVillagerWatcher extends AgeableWatcher {
|
||||
super(disguise);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public int getAngry() {
|
||||
return getData(MetaIndex.ABSTRACT_VILLAGER_ANGRY);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public boolean isAngry() {
|
||||
return getAngry() > 0;
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public void setAngry(int ticks) {
|
||||
setData(MetaIndex.ABSTRACT_VILLAGER_ANGRY, ticks);
|
||||
sendData(MetaIndex.ABSTRACT_VILLAGER_ANGRY);
|
||||
|
@ -57,12 +57,12 @@ public class AreaEffectCloudWatcher extends FlagWatcher {
|
||||
sendData(MetaIndex.AREA_EFFECT_IGNORE_RADIUS);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
@NmsAddedIn(value = NmsVersion.v1_13)
|
||||
public <T> void setParticle(Particle particle, T particleData) {
|
||||
setParticle(WrappedParticle.create(particle, particleData));
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
@NmsAddedIn(value = NmsVersion.v1_13)
|
||||
public WrappedParticle getParticle() {
|
||||
if (NmsVersion.v1_13.isSupported()) {
|
||||
return getData(MetaIndex.AREA_EFFECT_PARTICLE);
|
||||
@ -75,7 +75,7 @@ public class AreaEffectCloudWatcher extends FlagWatcher {
|
||||
}
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
@NmsAddedIn(value = NmsVersion.v1_13)
|
||||
public void setParticle(WrappedParticle particle) {
|
||||
if (NmsVersion.v1_13.isSupported()) {
|
||||
setData(MetaIndex.AREA_EFFECT_PARTICLE, particle);
|
||||
|
@ -20,12 +20,12 @@ public class ArrowWatcher extends FlagWatcher {
|
||||
sendData(MetaIndex.ARROW_CRITICAL);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public int getPierceLevel() {
|
||||
return getData(MetaIndex.ARROW_PIERCE_LEVEL);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public void setPierceLevel(int pierceLevel) {
|
||||
setData(MetaIndex.ARROW_PIERCE_LEVEL, (byte) pierceLevel);
|
||||
sendData(MetaIndex.ARROW_PIERCE_LEVEL);
|
||||
|
@ -8,7 +8,7 @@ import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
||||
/**
|
||||
* Created by libraryaddict on 14/12/2019.
|
||||
*/
|
||||
@NmsAddedIn(val = NmsVersion.v1_15)
|
||||
@NmsAddedIn(value = NmsVersion.v1_15)
|
||||
public class BeeWatcher extends AgeableWatcher {
|
||||
public BeeWatcher(Disguise disguise) {
|
||||
super(disguise);
|
||||
|
@ -41,12 +41,12 @@ public class BoatWatcher extends FlagWatcher {
|
||||
sendData(MetaIndex.BOAT_LEFT_PADDLING);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
@NmsAddedIn(value = NmsVersion.v1_13)
|
||||
public int getBoatShake() {
|
||||
return getData(MetaIndex.BOAT_SHAKE);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
@NmsAddedIn(value = NmsVersion.v1_13)
|
||||
public void setBoatShake(int number) {
|
||||
setData(MetaIndex.BOAT_SHAKE, number);
|
||||
sendData(MetaIndex.BOAT_SHAKE);
|
||||
|
@ -15,7 +15,7 @@ import java.util.Random;
|
||||
/**
|
||||
* Created by libraryaddict on 6/05/2019.
|
||||
*/
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public class CatWatcher extends TameableWatcher {
|
||||
public CatWatcher(Disguise disguise) {
|
||||
super(disguise);
|
||||
|
@ -20,12 +20,12 @@ public class EnderSignalWatcher extends FlagWatcher {
|
||||
}
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public ItemStack getItemStack() {
|
||||
return getData(MetaIndex.ENDER_SIGNAL_ITEM);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public void setItemStack(ItemStack item) {
|
||||
setData(MetaIndex.ENDER_SIGNAL_ITEM, item);
|
||||
sendData(MetaIndex.ENDER_SIGNAL_ITEM);
|
||||
|
@ -8,10 +8,13 @@ import me.libraryaddict.disguise.DisguiseAPI;
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||
import me.libraryaddict.disguise.utilities.reflection.NmsAddedIn;
|
||||
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
||||
import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
|
||||
import me.libraryaddict.disguise.utilities.translations.TranslateType;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@ -19,6 +22,7 @@ import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
public class FallingBlockWatcher extends FlagWatcher {
|
||||
private ItemStack block = new ItemStack(Material.STONE);
|
||||
private BlockData blockData;
|
||||
private boolean gridLocked;
|
||||
|
||||
public FallingBlockWatcher(Disguise disguise) {
|
||||
@ -28,7 +32,12 @@ public class FallingBlockWatcher extends FlagWatcher {
|
||||
@Override
|
||||
public FallingBlockWatcher clone(Disguise disguise) {
|
||||
FallingBlockWatcher watcher = (FallingBlockWatcher) super.clone(disguise);
|
||||
watcher.setBlock(getBlock().clone());
|
||||
|
||||
if (NmsVersion.v1_13.isSupported()) {
|
||||
watcher.setBlockData(getBlockData().clone());
|
||||
} else {
|
||||
watcher.setBlock(getBlock().clone());
|
||||
}
|
||||
|
||||
return watcher;
|
||||
}
|
||||
@ -98,4 +107,34 @@ public class FallingBlockWatcher extends FlagWatcher {
|
||||
DisguiseUtilities.refreshTrackers(getDisguise());
|
||||
}
|
||||
}
|
||||
|
||||
@NmsAddedIn(NmsVersion.v1_13)
|
||||
public BlockData getBlockData() {
|
||||
if (block != null && blockData == null) {
|
||||
return block.getType().createBlockData();
|
||||
}
|
||||
|
||||
return blockData;
|
||||
}
|
||||
|
||||
@NmsAddedIn(NmsVersion.v1_13)
|
||||
public void setBlockData(BlockData data) {
|
||||
if (data == null || data.getMaterial() == Material.AIR && data.getMaterial().isBlock()) {
|
||||
setBlock(null);
|
||||
return;
|
||||
}
|
||||
|
||||
this.block = new ItemStack(data.getMaterial());
|
||||
this.blockData = data;
|
||||
|
||||
if (!getDisguise().isCustomDisguiseName()) {
|
||||
getDisguise().setDisguiseName(TranslateType.DISGUISE_OPTIONS_PARAMETERS.get("Block") + " " +
|
||||
TranslateType.DISGUISE_OPTIONS_PARAMETERS
|
||||
.get(ReflectionManager.toReadable(block.getType().name())));
|
||||
}
|
||||
|
||||
if (DisguiseAPI.isDisguiseInUse(getDisguise()) && getDisguise().getWatcher() == this) {
|
||||
DisguiseUtilities.refreshTrackers(getDisguise());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,12 +20,12 @@ public class FireballWatcher extends FlagWatcher {
|
||||
}
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public ItemStack getItemStack() {
|
||||
return getData(MetaIndex.FIREBALL_ITEM);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public void setItemStack(ItemStack item) {
|
||||
setData(MetaIndex.FIREBALL_ITEM, item);
|
||||
sendData(MetaIndex.FIREBALL_ITEM);
|
||||
|
@ -35,18 +35,18 @@ public class FireworkWatcher extends FlagWatcher {
|
||||
sendData(MetaIndex.FIREWORK_ITEM);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public boolean isShotAtAngle() {
|
||||
return getData(MetaIndex.FIREWORK_SHOT_AT_ANGLE);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public void setShotAtAngle(boolean shotAtAngle) {
|
||||
setData(MetaIndex.FIREWORK_SHOT_AT_ANGLE, shotAtAngle);
|
||||
sendData(MetaIndex.FIREWORK_SHOT_AT_ANGLE);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public OptionalInt getAttachedEntityOpt() {
|
||||
return getData(MetaIndex.FIREWORK_ATTACHED_ENTITY);
|
||||
}
|
||||
@ -59,7 +59,7 @@ public class FireworkWatcher extends FlagWatcher {
|
||||
setAttachedEntity(entityId == 0 ? OptionalInt.empty() : OptionalInt.of(entityId));
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public void setAttachedEntity(OptionalInt entityId) {
|
||||
if (NmsVersion.v1_14.isSupported()) {
|
||||
setData(MetaIndex.FIREWORK_ATTACHED_ENTITY, entityId);
|
||||
|
@ -13,7 +13,7 @@ import java.util.Random;
|
||||
/**
|
||||
* Created by libraryaddict on 6/05/2019.
|
||||
*/
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public class FoxWatcher extends AgeableWatcher {
|
||||
public FoxWatcher(Disguise disguise) {
|
||||
super(disguise);
|
||||
|
@ -12,12 +12,12 @@ public class IllagerWizardWatcher extends IllagerWatcher {
|
||||
super(disguise);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public Spellcaster.Spell getSpell() {
|
||||
return Spellcaster.Spell.values()[getData(MetaIndex.ILLAGER_SPELL)];
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public void setSpell(Spellcaster.Spell spell) {
|
||||
setData(MetaIndex.ILLAGER_SPELL, (byte) spell.ordinal());
|
||||
sendData(MetaIndex.ILLAGER_SPELL);
|
||||
|
@ -43,12 +43,12 @@ public class InsentientWatcher extends LivingWatcher {
|
||||
return (getData(MetaIndex.INSENTIENT_META) & i) != 0;
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public boolean isEnraged() {
|
||||
return getInsentientFlag(4);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public void setEnraged(boolean enraged) {
|
||||
setInsentientFlag(4, enraged);
|
||||
}
|
||||
|
@ -40,12 +40,12 @@ public class LivingWatcher extends FlagWatcher {
|
||||
return clone;
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public BlockPosition getBedPosition() {
|
||||
return getData(MetaIndex.LIVING_BED_POSITION).orElse(null);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public void setBedPosition(BlockPosition blockPosition) {
|
||||
Optional<BlockPosition> optional;
|
||||
|
||||
@ -94,22 +94,22 @@ public class LivingWatcher extends FlagWatcher {
|
||||
sendData(MetaIndex.LIVING_HAND);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
@NmsAddedIn(value = NmsVersion.v1_13)
|
||||
public boolean isRightClicking() {
|
||||
return getHandFlag(0);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
@NmsAddedIn(value = NmsVersion.v1_13)
|
||||
public void setRightClicking(boolean setRightClicking) {
|
||||
setHandFlag(0, setRightClicking);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
@NmsAddedIn(value = NmsVersion.v1_13)
|
||||
public boolean isSpinning() {
|
||||
return getHandFlag(2);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
@NmsAddedIn(value = NmsVersion.v1_13)
|
||||
public void setSpinning(boolean setSpinning) {
|
||||
setHandFlag(2, setSpinning);
|
||||
}
|
||||
|
@ -14,12 +14,12 @@ public class MushroomCowWatcher extends AgeableWatcher {
|
||||
super(disguise);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public MushroomCow.Variant getVariant() {
|
||||
return MushroomCow.Variant.valueOf(getData(MetaIndex.MUSHROOM_COW_TYPE).toUpperCase());
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public void setVariant(MushroomCow.Variant variant) {
|
||||
setData(MetaIndex.MUSHROOM_COW_TYPE, variant.name().toLowerCase());
|
||||
sendData(MetaIndex.MUSHROOM_COW_TYPE);
|
||||
|
@ -16,12 +16,12 @@ public class OcelotWatcher extends AgeableWatcher {
|
||||
super(disguise);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public boolean isTrusting() {
|
||||
return getData(MetaIndex.OCELOT_TRUST);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public void setTrusting(boolean trusting) {
|
||||
setData(MetaIndex.OCELOT_TRUST, trusting);
|
||||
sendData(MetaIndex.OCELOT_TRUST);
|
||||
|
@ -13,7 +13,7 @@ import java.util.Random;
|
||||
/**
|
||||
* Created by libraryaddict on 6/05/2019.
|
||||
*/
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public class PandaWatcher extends AgeableWatcher {
|
||||
public PandaWatcher(Disguise disguise) {
|
||||
super(disguise);
|
||||
|
@ -8,7 +8,7 @@ import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
||||
/**
|
||||
* Created by libraryaddict on 6/05/2019.
|
||||
*/
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public class PillagerWatcher extends IllagerWatcher {
|
||||
public PillagerWatcher(Disguise disguise) {
|
||||
super(disguise);
|
||||
|
@ -7,7 +7,7 @@ import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
||||
/**
|
||||
* Created by libraryaddict on 6/05/2019.
|
||||
*/
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public class RavagerWatcher extends RaiderWatcher {
|
||||
public RavagerWatcher(Disguise disguise) {
|
||||
super(disguise);
|
||||
|
@ -22,13 +22,13 @@ public abstract class ThrowableWatcher extends FlagWatcher {
|
||||
|
||||
protected abstract ItemStack getDefaultItemStack();
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public ItemStack getItemStack() {
|
||||
return getData(MetaIndex.THROWABLE_ITEM);
|
||||
}
|
||||
|
||||
@RandomDefaultValue
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public void setItemStack(ItemStack item) {
|
||||
setData(MetaIndex.THROWABLE_ITEM, item);
|
||||
sendData(MetaIndex.THROWABLE_ITEM);
|
||||
|
@ -7,7 +7,7 @@ import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
||||
/**
|
||||
* Created by libraryaddict on 6/05/2019.
|
||||
*/
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public class TraderLlamaWatcher extends LlamaWatcher {
|
||||
public TraderLlamaWatcher(Disguise disguise) {
|
||||
super(disguise);
|
||||
|
@ -13,12 +13,12 @@ public class TridentWatcher extends ArrowWatcher {
|
||||
super(disguise);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_15)
|
||||
@NmsAddedIn(value = NmsVersion.v1_15)
|
||||
public boolean isEnchanted() {
|
||||
return getData(MetaIndex.TRIDENT_ENCHANTED);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_15)
|
||||
@NmsAddedIn(value = NmsVersion.v1_15)
|
||||
public void setEnchanted(boolean enchanted) {
|
||||
setData(MetaIndex.TRIDENT_ENCHANTED, enchanted);
|
||||
sendData(MetaIndex.TRIDENT_ENCHANTED);
|
||||
|
@ -21,12 +21,12 @@ public class VillagerWatcher extends AbstractVillagerWatcher {
|
||||
}
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public VillagerData getVillagerData() {
|
||||
return getData(MetaIndex.VILLAGER_DATA);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public void setVillagerData(VillagerData villagerData) {
|
||||
setData(MetaIndex.VILLAGER_DATA, villagerData);
|
||||
sendData(MetaIndex.VILLAGER_DATA);
|
||||
@ -51,33 +51,33 @@ public class VillagerWatcher extends AbstractVillagerWatcher {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public Villager.Type getType() {
|
||||
return getVillagerData().getType();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public void setType(Villager.Type type) {
|
||||
setVillagerData(new VillagerData(type, getProfession(), getLevel()));
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public Villager.Type getBiome() {
|
||||
return getType();
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public void setBiome(Villager.Type type) {
|
||||
setType(type);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public int getLevel() {
|
||||
return getVillagerData().getLevel();
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public void setLevel(int level) {
|
||||
setVillagerData(new VillagerData(getType(), getProfession(), level));
|
||||
}
|
||||
|
@ -44,12 +44,12 @@ public class ZombieVillagerWatcher extends ZombieWatcher {
|
||||
}
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public VillagerData getVillagerData() {
|
||||
return getData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public void setVillagerData(VillagerData villagerData) {
|
||||
setData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION, villagerData);
|
||||
sendData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION);
|
||||
@ -69,34 +69,34 @@ public class ZombieVillagerWatcher extends ZombieWatcher {
|
||||
}
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public Villager.Type getType() {
|
||||
return getVillagerData().getType();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public void setType(Villager.Type type) {
|
||||
setVillagerData(new VillagerData(type, getProfession(), getLevel()));
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public int getLevel() {
|
||||
return getVillagerData().getLevel();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public void setLevel(int level) {
|
||||
setVillagerData(new VillagerData(getType(), getProfession(), getLevel()));
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public Villager.Type getBiome() {
|
||||
return getType();
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@NmsAddedIn(value = NmsVersion.v1_14)
|
||||
public void setBiome(Villager.Type type) {
|
||||
setType(type);
|
||||
}
|
||||
|
@ -33,12 +33,12 @@ public class ZombieWatcher extends InsentientWatcher {
|
||||
setBaby(true);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
@NmsAddedIn(value = NmsVersion.v1_13)
|
||||
public boolean isConverting() {
|
||||
return getData(MetaIndex.ZOMBIE_CONVERTING_DROWNED);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
@NmsAddedIn(value = NmsVersion.v1_13)
|
||||
public void setConverting(boolean converting) {
|
||||
setData(MetaIndex.ZOMBIE_CONVERTING_DROWNED, converting);
|
||||
sendData(MetaIndex.ZOMBIE_CONVERTING_DROWNED);
|
||||
|
@ -43,6 +43,7 @@ import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.math.RandomUtils;
|
||||
import org.apache.logging.log4j.util.Strings;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.boss.KeyedBossBar;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.*;
|
||||
@ -1112,6 +1113,10 @@ public class DisguiseUtilities {
|
||||
gsonBuilder.registerTypeAdapter(FlagWatcher.class, new SerializerFlagWatcher(gsonBuilder.create()));
|
||||
gsonBuilder.registerTypeAdapter(Disguise.class, new SerializerDisguise());
|
||||
|
||||
if (NmsVersion.v1_13.isSupported()) {
|
||||
gsonBuilder.registerTypeAdapter(BlockData.class, new SerializerBlockData());
|
||||
}
|
||||
|
||||
gson = gsonBuilder.create();
|
||||
|
||||
if (!profileCache.exists())
|
||||
|
@ -0,0 +1,25 @@
|
||||
package me.libraryaddict.disguise.utilities.json;
|
||||
|
||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||
import com.google.gson.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
/**
|
||||
* Created by libraryaddict on 27/11/2018.
|
||||
*/
|
||||
public class SerializerBlockData implements JsonDeserializer<BlockData>,
|
||||
JsonSerializer<BlockData> {
|
||||
@Override
|
||||
public BlockData deserialize(JsonElement json, Type typeOfT,
|
||||
JsonDeserializationContext context) throws JsonParseException {
|
||||
return Bukkit.createBlockData(json.getAsString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonElement serialize(BlockData src, Type typeOfSrc, JsonSerializationContext context) {
|
||||
return context.serialize(src.getAsString());
|
||||
}
|
||||
}
|
@ -304,9 +304,13 @@ public class PacketHandlerSpawn implements IPacketHandler {
|
||||
double z = loc.getZ();
|
||||
|
||||
if (disguise.getType() == DisguiseType.FALLING_BLOCK) {
|
||||
ItemStack block = ((FallingBlockWatcher) disguise.getWatcher()).getBlock();
|
||||
if (NmsVersion.v1_13.isSupported()) {
|
||||
|
||||
} else {
|
||||
ItemStack block = ((FallingBlockWatcher) disguise.getWatcher()).getBlock();
|
||||
data = ReflectionManager.getCombinedIdByItemStack(block);
|
||||
}
|
||||
|
||||
data = ReflectionManager.getCombinedIdByItemStack(block);
|
||||
|
||||
if (((FallingBlockWatcher) disguise.getWatcher()).isGridLocked()) {
|
||||
// Center the block
|
||||
|
@ -13,6 +13,7 @@ import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.boss.BarColor;
|
||||
import org.bukkit.boss.BarStyle;
|
||||
import org.bukkit.entity.*;
|
||||
@ -77,6 +78,8 @@ public class ParamInfoTypes {
|
||||
paramInfos.add(new ParamInfoParticle(WrappedParticle.class, "Particle",
|
||||
"The different particles of Minecraft", Particle.values(), getMaterials()));
|
||||
paramInfos.add(new ParamInfoEnum(TropicalFish.Pattern.class, "Pattern", "Patterns of a tropical fish"));
|
||||
paramInfos.add(new ParamInfoBlockData(BlockData.class, "BlockData",
|
||||
"The block data states, barrel[facing=north,open=false] as example"));
|
||||
} else {
|
||||
paramInfos.add(new ParamInfoEnum(Particle.class, "Particle", "The different particles of Minecraft"));
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
package me.libraryaddict.disguise.utilities.params.types.custom;
|
||||
|
||||
import me.libraryaddict.disguise.utilities.params.ParamInfo;
|
||||
import me.libraryaddict.disguise.utilities.parser.DisguiseParseException;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
/**
|
||||
* Created by libraryaddict on 12/08/2020.
|
||||
*/
|
||||
public class ParamInfoBlockData extends ParamInfo {
|
||||
public ParamInfoBlockData(Class paramClass, String name, String description) {
|
||||
super(paramClass, name, description);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object fromString(String string) throws DisguiseParseException {
|
||||
if (string == null || string.equals("null")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Bukkit.createBlockData(string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(Object object) {
|
||||
if (object == null) {
|
||||
return "null";
|
||||
}
|
||||
|
||||
return ((BlockData) object).getAsString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isParam(Class paramClass) {
|
||||
return getParamClass().isAssignableFrom(paramClass);
|
||||
}
|
||||
}
|
@ -8,5 +8,5 @@ import java.lang.annotation.RetentionPolicy;
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface NmsAddedIn {
|
||||
NmsVersion val();
|
||||
NmsVersion value();
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ import me.libraryaddict.disguise.utilities.sounds.SoundGroup;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.command.SimpleCommandMap;
|
||||
@ -131,7 +133,7 @@ public class ReflectionManager {
|
||||
NmsAddedIn added = obj.getAnnotation(NmsAddedIn.class);
|
||||
|
||||
// If it was added after this version
|
||||
if (!added.val().isSupported()) {
|
||||
if (!added.value().isSupported()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1463,6 +1465,19 @@ public class ReflectionManager {
|
||||
return new WrappedWatchableObject(watcherItem);
|
||||
}
|
||||
|
||||
public static int getCombinedIdByBlockData(BlockData data) {
|
||||
try {
|
||||
Object iBlockData = getCraftMethod("block.data.type.CraftBlockData", "getState").invoke(data);
|
||||
|
||||
return (int) getNmsMethod("Block", "getCombinedId", getNmsClass("IBlockData")).invoke(null, iBlockData);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int getCombinedIdByItemStack(ItemStack itemStack) {
|
||||
try {
|
||||
Object nmsBlock;
|
||||
|
@ -116,9 +116,9 @@ public class CompileMethods {
|
||||
int removed = -1;
|
||||
|
||||
if (method.isAnnotationPresent(NmsAddedIn.class)) {
|
||||
added = method.getAnnotation(NmsAddedIn.class).val().ordinal();
|
||||
added = method.getAnnotation(NmsAddedIn.class).value().ordinal();
|
||||
} else if (method.getDeclaringClass().isAnnotationPresent(NmsAddedIn.class)) {
|
||||
added = method.getDeclaringClass().getAnnotation(NmsAddedIn.class).val().ordinal();
|
||||
added = method.getDeclaringClass().getAnnotation(NmsAddedIn.class).value().ordinal();
|
||||
}
|
||||
|
||||
if (method.isAnnotationPresent(NmsRemovedIn.class)) {
|
||||
|
Loading…
Reference in New Issue
Block a user