mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-26 04:35:50 +01:00
Change EAT_FOOD to LEAVE_BED in 1.18/17
This commit is contained in:
parent
2a5b62aae0
commit
b0f1290b58
@ -3,6 +3,7 @@ package net.citizensnpcs.trait;
|
|||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
import org.bukkit.util.EulerAngle;
|
import org.bukkit.util.EulerAngle;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.api.persistence.Persist;
|
import net.citizensnpcs.api.persistence.Persist;
|
||||||
import net.citizensnpcs.api.trait.Trait;
|
import net.citizensnpcs.api.trait.Trait;
|
||||||
import net.citizensnpcs.api.trait.TraitName;
|
import net.citizensnpcs.api.trait.TraitName;
|
||||||
@ -120,6 +121,20 @@ public class ArmorStandTrait extends Trait {
|
|||||||
entity.setMarker(marker);
|
entity.setMarker(marker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures the entity as an invisible point entity, e.g. for mounting NPCs on top, nameplates, etc.
|
||||||
|
*/
|
||||||
|
public void setAsPointEntity() {
|
||||||
|
setGravity(false);
|
||||||
|
setHasArms(false);
|
||||||
|
setHasBaseplate(false);
|
||||||
|
setSmall(true);
|
||||||
|
setMarker(true);
|
||||||
|
setVisible(false);
|
||||||
|
npc.setProtected(true);
|
||||||
|
npc.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ArmorStand#setGravity(boolean)
|
* @see ArmorStand#setGravity(boolean)
|
||||||
*/
|
*/
|
||||||
|
@ -73,13 +73,7 @@ public class HologramTrait extends Trait {
|
|||||||
private NPC createHologram(String line, double heightOffset) {
|
private NPC createHologram(String line, double heightOffset) {
|
||||||
NPC hologramNPC = registry.createNPC(EntityType.ARMOR_STAND, line);
|
NPC hologramNPC = registry.createNPC(EntityType.ARMOR_STAND, line);
|
||||||
hologramNPC.addTrait(new ClickRedirectTrait(npc));
|
hologramNPC.addTrait(new ClickRedirectTrait(npc));
|
||||||
ArmorStandTrait trait = hologramNPC.getOrAddTrait(ArmorStandTrait.class);
|
hologramNPC.getOrAddTrait(ArmorStandTrait.class).setAsPointEntity();
|
||||||
trait.setVisible(false);
|
|
||||||
trait.setSmall(true);
|
|
||||||
trait.setMarker(true);
|
|
||||||
trait.setGravity(false);
|
|
||||||
trait.setHasArms(false);
|
|
||||||
trait.setHasBaseplate(false);
|
|
||||||
hologramNPC.spawn(currentLoc.clone().add(0,
|
hologramNPC.spawn(currentLoc.clone().add(0,
|
||||||
getEntityHeight()
|
getEntityHeight()
|
||||||
+ (direction == HologramDirection.BOTTOM_UP ? heightOffset : getMaxHeight() - heightOffset),
|
+ (direction == HologramDirection.BOTTOM_UP ? heightOffset : getMaxHeight() - heightOffset),
|
||||||
|
@ -41,7 +41,7 @@ public class LookClose extends Trait implements Toggleable, CommandConfigurable
|
|||||||
@Persist
|
@Persist
|
||||||
private int randomLookDelay = Setting.DEFAULT_RANDOM_LOOK_DELAY.asInt();
|
private int randomLookDelay = Setting.DEFAULT_RANDOM_LOOK_DELAY.asInt();
|
||||||
@Persist
|
@Persist
|
||||||
private float[] randomPitchRange = { -10, 0 };
|
private float[] randomPitchRange = { 0, 0 };
|
||||||
@Persist
|
@Persist
|
||||||
private float[] randomYawRange = { 0, 360 };
|
private float[] randomYawRange = { 0, 360 };
|
||||||
private double range = Setting.DEFAULT_LOOK_CLOSE_RANGE.asDouble();
|
private double range = Setting.DEFAULT_LOOK_CLOSE_RANGE.asDouble();
|
||||||
|
@ -8,6 +8,7 @@ public enum PlayerAnimation {
|
|||||||
CRIT,
|
CRIT,
|
||||||
EAT_FOOD,
|
EAT_FOOD,
|
||||||
HURT,
|
HURT,
|
||||||
|
LEAVE_BED,
|
||||||
MAGIC_CRIT,
|
MAGIC_CRIT,
|
||||||
SIT,
|
SIT,
|
||||||
SLEEP,
|
SLEEP,
|
||||||
|
@ -42,17 +42,8 @@ public class PlayerAnimationImpl {
|
|||||||
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
||||||
}
|
}
|
||||||
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
||||||
|
holder.getOrAddTrait(ArmorStandTrait.class).setAsPointEntity();
|
||||||
holder.spawn(player.getBukkitEntity().getLocation());
|
holder.spawn(player.getBukkitEntity().getLocation());
|
||||||
ArmorStandTrait trait = holder.getOrAddTrait(ArmorStandTrait.class);
|
|
||||||
trait.setGravity(false);
|
|
||||||
trait.setHasArms(false);
|
|
||||||
trait.setHasBaseplate(false);
|
|
||||||
trait.setSmall(true);
|
|
||||||
trait.setMarker(true);
|
|
||||||
trait.setVisible(false);
|
|
||||||
holder.getOrAddTrait(ArmorStandTrait.class).setVisible(false);
|
|
||||||
holder.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, false);
|
|
||||||
holder.data().set(NPC.DEFAULT_PROTECTED_METADATA, true);
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void cancel() {
|
public void cancel() {
|
||||||
|
@ -42,17 +42,8 @@ public class PlayerAnimationImpl {
|
|||||||
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
||||||
}
|
}
|
||||||
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
||||||
|
holder.getOrAddTrait(ArmorStandTrait.class).setAsPointEntity();
|
||||||
holder.spawn(player.getBukkitEntity().getLocation());
|
holder.spawn(player.getBukkitEntity().getLocation());
|
||||||
ArmorStandTrait trait = holder.getOrAddTrait(ArmorStandTrait.class);
|
|
||||||
trait.setGravity(false);
|
|
||||||
trait.setHasArms(false);
|
|
||||||
trait.setHasBaseplate(false);
|
|
||||||
trait.setSmall(true);
|
|
||||||
trait.setMarker(true);
|
|
||||||
trait.setVisible(false);
|
|
||||||
holder.getOrAddTrait(ArmorStandTrait.class).setVisible(false);
|
|
||||||
holder.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, false);
|
|
||||||
holder.data().set(NPC.DEFAULT_PROTECTED_METADATA, true);
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void cancel() {
|
public void cancel() {
|
||||||
|
@ -42,16 +42,8 @@ public class PlayerAnimationImpl {
|
|||||||
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
||||||
}
|
}
|
||||||
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
||||||
|
holder.getOrAddTrait(ArmorStandTrait.class).setAsPointEntity();
|
||||||
holder.spawn(player.getBukkitEntity().getLocation());
|
holder.spawn(player.getBukkitEntity().getLocation());
|
||||||
ArmorStandTrait trait = holder.getOrAddTrait(ArmorStandTrait.class);
|
|
||||||
trait.setGravity(false);
|
|
||||||
trait.setHasArms(false);
|
|
||||||
trait.setHasBaseplate(false);
|
|
||||||
trait.setSmall(true);
|
|
||||||
trait.setMarker(true);
|
|
||||||
trait.setVisible(false);
|
|
||||||
holder.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, false);
|
|
||||||
holder.data().set(NPC.DEFAULT_PROTECTED_METADATA, true);
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void cancel() {
|
public void cancel() {
|
||||||
|
@ -42,16 +42,8 @@ public class PlayerAnimationImpl {
|
|||||||
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
||||||
}
|
}
|
||||||
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
||||||
|
holder.getOrAddTrait(ArmorStandTrait.class).setAsPointEntity();
|
||||||
holder.spawn(player.getBukkitEntity().getLocation());
|
holder.spawn(player.getBukkitEntity().getLocation());
|
||||||
ArmorStandTrait trait = holder.getOrAddTrait(ArmorStandTrait.class);
|
|
||||||
trait.setGravity(false);
|
|
||||||
trait.setHasArms(false);
|
|
||||||
trait.setHasBaseplate(false);
|
|
||||||
trait.setSmall(true);
|
|
||||||
trait.setMarker(true);
|
|
||||||
trait.setVisible(false);
|
|
||||||
holder.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, false);
|
|
||||||
holder.data().set(NPC.DEFAULT_PROTECTED_METADATA, true);
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void cancel() {
|
public void cancel() {
|
||||||
|
@ -42,16 +42,8 @@ public class PlayerAnimationImpl {
|
|||||||
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
||||||
}
|
}
|
||||||
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
||||||
|
holder.getOrAddTrait(ArmorStandTrait.class).setAsPointEntity();
|
||||||
holder.spawn(player.getBukkitEntity().getLocation());
|
holder.spawn(player.getBukkitEntity().getLocation());
|
||||||
ArmorStandTrait trait = holder.getOrAddTrait(ArmorStandTrait.class);
|
|
||||||
trait.setGravity(false);
|
|
||||||
trait.setHasArms(false);
|
|
||||||
trait.setHasBaseplate(false);
|
|
||||||
trait.setSmall(true);
|
|
||||||
trait.setMarker(true);
|
|
||||||
trait.setVisible(false);
|
|
||||||
holder.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, false);
|
|
||||||
holder.data().set(NPC.DEFAULT_PROTECTED_METADATA, true);
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void cancel() {
|
public void cancel() {
|
||||||
|
@ -42,16 +42,8 @@ public class PlayerAnimationImpl {
|
|||||||
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
||||||
}
|
}
|
||||||
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
||||||
|
holder.getOrAddTrait(ArmorStandTrait.class).setAsPointEntity();
|
||||||
holder.spawn(player.getBukkitEntity().getLocation());
|
holder.spawn(player.getBukkitEntity().getLocation());
|
||||||
ArmorStandTrait trait = holder.getOrAddTrait(ArmorStandTrait.class);
|
|
||||||
trait.setGravity(false);
|
|
||||||
trait.setHasArms(false);
|
|
||||||
trait.setHasBaseplate(false);
|
|
||||||
trait.setSmall(true);
|
|
||||||
trait.setMarker(true);
|
|
||||||
trait.setVisible(false);
|
|
||||||
holder.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, false);
|
|
||||||
holder.data().set(NPC.DEFAULT_PROTECTED_METADATA, true);
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void cancel() {
|
public void cancel() {
|
||||||
|
@ -42,16 +42,8 @@ public class PlayerAnimationImpl {
|
|||||||
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
||||||
}
|
}
|
||||||
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
||||||
|
holder.getOrAddTrait(ArmorStandTrait.class).setAsPointEntity();
|
||||||
holder.spawn(player.getBukkitEntity().getLocation());
|
holder.spawn(player.getBukkitEntity().getLocation());
|
||||||
ArmorStandTrait trait = holder.getOrAddTrait(ArmorStandTrait.class);
|
|
||||||
trait.setGravity(false);
|
|
||||||
trait.setHasArms(false);
|
|
||||||
trait.setHasBaseplate(false);
|
|
||||||
trait.setSmall(true);
|
|
||||||
trait.setMarker(true);
|
|
||||||
trait.setVisible(false);
|
|
||||||
holder.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, false);
|
|
||||||
holder.data().set(NPC.DEFAULT_PROTECTED_METADATA, true);
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void cancel() {
|
public void cancel() {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package net.citizensnpcs.nms.v1_17_R1.util;
|
package net.citizensnpcs.nms.v1_17_R1.util;
|
||||||
|
|
||||||
import java.lang.invoke.MethodHandle;
|
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
|
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
@ -23,7 +22,6 @@ import net.minecraft.network.protocol.game.ClientboundAnimatePacket;
|
|||||||
import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket;
|
import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.Pose;
|
import net.minecraft.world.entity.Pose;
|
||||||
|
|
||||||
public class PlayerAnimationImpl {
|
public class PlayerAnimationImpl {
|
||||||
@ -42,16 +40,8 @@ public class PlayerAnimationImpl {
|
|||||||
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
||||||
}
|
}
|
||||||
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
||||||
|
holder.getOrAddTrait(ArmorStandTrait.class).setAsPointEntity();
|
||||||
holder.spawn(player.getBukkitEntity().getLocation());
|
holder.spawn(player.getBukkitEntity().getLocation());
|
||||||
ArmorStandTrait trait = holder.getOrAddTrait(ArmorStandTrait.class);
|
|
||||||
trait.setGravity(false);
|
|
||||||
trait.setHasArms(false);
|
|
||||||
trait.setHasBaseplate(false);
|
|
||||||
trait.setSmall(true);
|
|
||||||
trait.setMarker(true);
|
|
||||||
trait.setVisible(false);
|
|
||||||
holder.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, false);
|
|
||||||
holder.data().set(NPC.DEFAULT_PROTECTED_METADATA, true);
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void cancel() {
|
public void cancel() {
|
||||||
@ -78,11 +68,7 @@ public class PlayerAnimationImpl {
|
|||||||
}.runTaskTimer(CitizensAPI.getPlugin(), 0, 1);
|
}.runTaskTimer(CitizensAPI.getPlugin(), 0, 1);
|
||||||
break;
|
break;
|
||||||
case SLEEP:
|
case SLEEP:
|
||||||
try {
|
player.setPose(Pose.SLEEPING);
|
||||||
ENTITY_SETPOSE_METHOD.invoke(player, Pose.SLEEPING);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case SNEAK:
|
case SNEAK:
|
||||||
player.getBukkitEntity().setSneaking(true);
|
player.getBukkitEntity().setSneaking(true);
|
||||||
@ -108,11 +94,7 @@ public class PlayerAnimationImpl {
|
|||||||
NMS.mount(player.getBukkitEntity(), null);
|
NMS.mount(player.getBukkitEntity(), null);
|
||||||
break;
|
break;
|
||||||
case STOP_SLEEPING:
|
case STOP_SLEEPING:
|
||||||
try {
|
player.setPose(Pose.STANDING);
|
||||||
ENTITY_SETPOSE_METHOD.invoke(player, Pose.STANDING);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case STOP_SNEAKING:
|
case STOP_SNEAKING:
|
||||||
player.getBukkitEntity().setSneaking(false);
|
player.getBukkitEntity().setSneaking(false);
|
||||||
@ -139,12 +121,10 @@ public class PlayerAnimationImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static EnumMap<PlayerAnimation, Integer> DEFAULTS = Maps.newEnumMap(PlayerAnimation.class);
|
private static EnumMap<PlayerAnimation, Integer> DEFAULTS = Maps.newEnumMap(PlayerAnimation.class);
|
||||||
private static final MethodHandle ENTITY_SETPOSE_METHOD = NMS.getMethodHandle(Entity.class, "setPose", true,
|
|
||||||
Pose.class);
|
|
||||||
static {
|
static {
|
||||||
DEFAULTS.put(PlayerAnimation.ARM_SWING, 0);
|
DEFAULTS.put(PlayerAnimation.ARM_SWING, 0);
|
||||||
DEFAULTS.put(PlayerAnimation.HURT, 1);
|
DEFAULTS.put(PlayerAnimation.HURT, 1);
|
||||||
DEFAULTS.put(PlayerAnimation.EAT_FOOD, 2);
|
DEFAULTS.put(PlayerAnimation.LEAVE_BED, 2);
|
||||||
DEFAULTS.put(PlayerAnimation.ARM_SWING_OFFHAND, 3);
|
DEFAULTS.put(PlayerAnimation.ARM_SWING_OFFHAND, 3);
|
||||||
DEFAULTS.put(PlayerAnimation.CRIT, 4);
|
DEFAULTS.put(PlayerAnimation.CRIT, 4);
|
||||||
DEFAULTS.put(PlayerAnimation.MAGIC_CRIT, 5);
|
DEFAULTS.put(PlayerAnimation.MAGIC_CRIT, 5);
|
||||||
|
@ -275,6 +275,7 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
|||||||
// the entity is a player. there is no client so make this happen
|
// the entity is a player. there is no client so make this happen
|
||||||
// manually.
|
// manually.
|
||||||
boolean damaged = super.hurt(damagesource, f);
|
boolean damaged = super.hurt(damagesource, f);
|
||||||
|
|
||||||
if (damaged && hurtMarked) {
|
if (damaged && hurtMarked) {
|
||||||
hurtMarked = false;
|
hurtMarked = false;
|
||||||
Bukkit.getScheduler().runTask(CitizensAPI.getPlugin(), new Runnable() {
|
Bukkit.getScheduler().runTask(CitizensAPI.getPlugin(), new Runnable() {
|
||||||
|
@ -40,16 +40,8 @@ public class PlayerAnimationImpl {
|
|||||||
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
||||||
}
|
}
|
||||||
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
||||||
|
holder.getOrAddTrait(ArmorStandTrait.class).setAsPointEntity();
|
||||||
holder.spawn(player.getBukkitEntity().getLocation());
|
holder.spawn(player.getBukkitEntity().getLocation());
|
||||||
ArmorStandTrait trait = holder.getOrAddTrait(ArmorStandTrait.class);
|
|
||||||
trait.setGravity(false);
|
|
||||||
trait.setHasArms(false);
|
|
||||||
trait.setHasBaseplate(false);
|
|
||||||
trait.setSmall(true);
|
|
||||||
trait.setMarker(true);
|
|
||||||
trait.setVisible(false);
|
|
||||||
holder.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, false);
|
|
||||||
holder.data().set(NPC.DEFAULT_PROTECTED_METADATA, true);
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void cancel() {
|
public void cancel() {
|
||||||
@ -132,7 +124,7 @@ public class PlayerAnimationImpl {
|
|||||||
static {
|
static {
|
||||||
DEFAULTS.put(PlayerAnimation.ARM_SWING, 0);
|
DEFAULTS.put(PlayerAnimation.ARM_SWING, 0);
|
||||||
DEFAULTS.put(PlayerAnimation.HURT, 1);
|
DEFAULTS.put(PlayerAnimation.HURT, 1);
|
||||||
DEFAULTS.put(PlayerAnimation.EAT_FOOD, 2);
|
DEFAULTS.put(PlayerAnimation.LEAVE_BED, 2);
|
||||||
DEFAULTS.put(PlayerAnimation.ARM_SWING_OFFHAND, 3);
|
DEFAULTS.put(PlayerAnimation.ARM_SWING_OFFHAND, 3);
|
||||||
DEFAULTS.put(PlayerAnimation.CRIT, 4);
|
DEFAULTS.put(PlayerAnimation.CRIT, 4);
|
||||||
DEFAULTS.put(PlayerAnimation.MAGIC_CRIT, 5);
|
DEFAULTS.put(PlayerAnimation.MAGIC_CRIT, 5);
|
||||||
|
@ -41,16 +41,8 @@ public class PlayerAnimationImpl {
|
|||||||
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
||||||
}
|
}
|
||||||
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
||||||
|
holder.getOrAddTrait(ArmorStandTrait.class).setAsPointEntity();
|
||||||
holder.spawn(player.getBukkitEntity().getLocation());
|
holder.spawn(player.getBukkitEntity().getLocation());
|
||||||
ArmorStandTrait trait = holder.getOrAddTrait(ArmorStandTrait.class);
|
|
||||||
trait.setGravity(false);
|
|
||||||
trait.setHasArms(false);
|
|
||||||
trait.setHasBaseplate(false);
|
|
||||||
trait.setSmall(true);
|
|
||||||
trait.setMarker(true);
|
|
||||||
trait.setVisible(false);
|
|
||||||
holder.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, false);
|
|
||||||
holder.data().set(NPC.DEFAULT_PROTECTED_METADATA, true);
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void cancel() {
|
public void cancel() {
|
||||||
|
Loading…
Reference in New Issue
Block a user