fix: sync with latest API change (#3169)

This commit is contained in:
ZX夏夜之风 2024-10-29 19:57:35 +08:00 committed by GitHub
parent 1579aa0e9e
commit 05ebf99d37
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 5 additions and 5 deletions

View File

@ -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);
}
}

View File

@ -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");

View File

@ -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());

View File

@ -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;
}

View File

@ -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();
}