mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-22 09:07:56 +01:00
fix: sync with latest API change (#3169)
This commit is contained in:
parent
1579aa0e9e
commit
05ebf99d37
@ -399,7 +399,7 @@ public class CitizensNPC extends AbstractNPC {
|
||||
|
||||
if (type == EntityType.PLAYER || Util.isHorse(type)) {
|
||||
if (SUPPORT_ATTRIBUTES && !hasTrait(AttributeTrait.class)
|
||||
|| !getTrait(AttributeTrait.class).hasAttribute(Attribute.GENERIC_STEP_HEIGHT)) {
|
||||
|| !getTrait(AttributeTrait.class).hasAttribute(Attribute.STEP_HEIGHT)) {
|
||||
NMS.setStepHeight(entity, 1);
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import net.citizensnpcs.api.trait.TraitName;
|
||||
@TraitName("attributetrait")
|
||||
public class AttributeTrait extends Trait {
|
||||
@Persist(keyType = Attribute.class)
|
||||
private final Map<Attribute, Double> attributes = Maps.newEnumMap(Attribute.class);
|
||||
private final Map<Attribute, Double> attributes = Maps.newHashMap();
|
||||
|
||||
public AttributeTrait() {
|
||||
super("attributetrait");
|
||||
|
@ -918,7 +918,7 @@ public class HologramTrait extends Trait {
|
||||
disp.setBackgroundColor(color);
|
||||
}
|
||||
if (SpigotUtil.getVersion()[1] >= 21 && base.getEntity() instanceof LivingEntity) {
|
||||
AttributeInstance inst = ((LivingEntity) base.getEntity()).getAttribute(Attribute.GENERIC_SCALE);
|
||||
AttributeInstance inst = ((LivingEntity) base.getEntity()).getAttribute(Attribute.SCALE);
|
||||
if (inst != null) {
|
||||
Transformation tf = disp.getTransformation();
|
||||
tf.getScale().set(inst.getValue());
|
||||
|
@ -143,7 +143,7 @@ public class BossBarTrait extends Trait {
|
||||
double maxHealth = entity.getMaxHealth();
|
||||
if (SUPPORT_ATTRIBUTES) {
|
||||
try {
|
||||
maxHealth = entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
|
||||
maxHealth = entity.getAttribute(Attribute.MAX_HEALTH).getValue();
|
||||
} catch (Throwable t) {
|
||||
SUPPORT_ATTRIBUTES = false;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ public class NMS {
|
||||
return;
|
||||
if (SUPPORT_KNOCKBACK_RESISTANCE && npc.getEntity() instanceof Attributable) {
|
||||
AttributeInstance attribute = ((Attributable) npc.getEntity())
|
||||
.getAttribute(Attribute.GENERIC_KNOCKBACK_RESISTANCE);
|
||||
.getAttribute(Attribute.KNOCKBACK_RESISTANCE);
|
||||
if (attribute != null) {
|
||||
strength *= 1 - attribute.getValue();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user