mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
living entity allow attribute registration
This commit is contained in:
parent
0312fd2b42
commit
6b65e03d85
@ -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);
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
|
||||
// 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
|
||||
public void setAI(boolean ai) {
|
||||
if (this.getHandle() instanceof Mob) {
|
||||
|
Loading…
Reference in New Issue
Block a user