mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-10 17:52:02 -07:00
living entity allow attribute registration
This commit is contained in:
@@ -0,0 +1,15 @@
|
|||||||
|
--- a/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||||
|
+++ b/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||||
|
@@ -162,4 +162,12 @@
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ // Paper - start - living entity allow attribute registration
|
||||||
|
+ public void registerAttribute(Holder<Attribute> attributeBase) {
|
||||||
|
+ AttributeInstance attributeModifiable = new AttributeInstance(attributeBase, AttributeInstance::getAttribute);
|
||||||
|
+ attributes.put(attributeBase, attributeModifiable);
|
||||||
|
+ }
|
||||||
|
+ // Paper - end - living entity allow attribute registration
|
||||||
|
+
|
||||||
|
}
|
@@ -35,4 +35,11 @@ public class CraftAttributeMap implements Attributable {
|
|||||||
|
|
||||||
return (nms == null) ? null : new CraftAttributeInstance(nms, attribute);
|
return (nms == null) ? null : new CraftAttributeInstance(nms, attribute);
|
||||||
}
|
}
|
||||||
|
// Paper start - living entity allow attribute registration
|
||||||
|
@Override
|
||||||
|
public void registerAttribute(Attribute attribute) {
|
||||||
|
Preconditions.checkArgument(attribute != null, "attribute");
|
||||||
|
handle.registerAttribute(CraftAttribute.bukkitToMinecraftHolder(attribute));
|
||||||
|
}
|
||||||
|
// Paper end - living entity allow attribute registration
|
||||||
}
|
}
|
||||||
|
@@ -775,6 +775,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||||||
return this.getHandle().craftAttributes.getAttribute(attribute);
|
return this.getHandle().craftAttributes.getAttribute(attribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Paper start - living entity allow attribute registration
|
||||||
|
@Override
|
||||||
|
public void registerAttribute(Attribute attribute) {
|
||||||
|
getHandle().craftAttributes.registerAttribute(attribute);
|
||||||
|
}
|
||||||
|
// Paper end - living entity allow attribute registration
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAI(boolean ai) {
|
public void setAI(boolean ai) {
|
||||||
if (this.getHandle() instanceof Mob) {
|
if (this.getHandle() instanceof Mob) {
|
||||||
|
Reference in New Issue
Block a user