Class EntityAttributeInstance

java.lang.Object
net.minecraft.entity.attribute.EntityAttributeInstance

public class EntityAttributeInstance extends Object
A double-valued attribute.
Mappings:
Namespace Name
named net/minecraft/entity/attribute/EntityAttributeInstance
intermediary net/minecraft/class_1324
official bxj
  • Field Details

    • BASE_NBT_KEY

      private static final String BASE_NBT_KEY
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named BASE_NBT_KEY Lnet/minecraft/entity/attribute/EntityAttributeInstance;BASE_NBT_KEY:Ljava/lang/String;
      intermediary field_52008 Lnet/minecraft/class_1324;field_52008:Ljava/lang/String;
      official b Lbxj;b:Ljava/lang/String;
    • MODIFIERS_NBT_KEY

      private static final String MODIFIERS_NBT_KEY
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named MODIFIERS_NBT_KEY Lnet/minecraft/entity/attribute/EntityAttributeInstance;MODIFIERS_NBT_KEY:Ljava/lang/String;
      intermediary field_52009 Lnet/minecraft/class_1324;field_52009:Ljava/lang/String;
      official c Lbxj;c:Ljava/lang/String;
    • ID_NBT_KEY

      public static final String ID_NBT_KEY
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named ID_NBT_KEY Lnet/minecraft/entity/attribute/EntityAttributeInstance;ID_NBT_KEY:Ljava/lang/String;
      intermediary field_52007 Lnet/minecraft/class_1324;field_52007:Ljava/lang/String;
      official a Lbxj;a:Ljava/lang/String;
    • type

      private final RegistryEntry<EntityAttribute> type
      Mappings:
      Namespace Name Mixin selector
      named type Lnet/minecraft/entity/attribute/EntityAttributeInstance;type:Lnet/minecraft/registry/entry/RegistryEntry;
      intermediary field_23700 Lnet/minecraft/class_1324;field_23700:Lnet/minecraft/class_6880;
      official d Lbxj;d:Ljq;
    • operationToModifiers

      Mappings:
      Namespace Name Mixin selector
      named operationToModifiers Lnet/minecraft/entity/attribute/EntityAttributeInstance;operationToModifiers:Ljava/util/Map;
      intermediary field_23701 Lnet/minecraft/class_1324;field_23701:Ljava/util/Map;
      official e Lbxj;e:Ljava/util/Map;
    • idToModifiers

      private final Map<Identifier,EntityAttributeModifier> idToModifiers
      Mappings:
      Namespace Name Mixin selector
      named idToModifiers Lnet/minecraft/entity/attribute/EntityAttributeInstance;idToModifiers:Ljava/util/Map;
      intermediary field_23702 Lnet/minecraft/class_1324;field_23702:Ljava/util/Map;
      official f Lbxj;f:Ljava/util/Map;
    • persistentModifiers

      private final Map<Identifier,EntityAttributeModifier> persistentModifiers
      Mappings:
      Namespace Name Mixin selector
      named persistentModifiers Lnet/minecraft/entity/attribute/EntityAttributeInstance;persistentModifiers:Ljava/util/Map;
      intermediary field_23703 Lnet/minecraft/class_1324;field_23703:Ljava/util/Map;
      official g Lbxj;g:Ljava/util/Map;
    • baseValue

      private double baseValue
      Mappings:
      Namespace Name Mixin selector
      named baseValue Lnet/minecraft/entity/attribute/EntityAttributeInstance;baseValue:D
      intermediary field_23704 Lnet/minecraft/class_1324;field_23704:D
      official h Lbxj;h:D
    • dirty

      private boolean dirty
      Mappings:
      Namespace Name Mixin selector
      named dirty Lnet/minecraft/entity/attribute/EntityAttributeInstance;dirty:Z
      intermediary field_23705 Lnet/minecraft/class_1324;field_23705:Z
      official i Lbxj;i:Z
    • value

      private double value
      Mappings:
      Namespace Name Mixin selector
      named value Lnet/minecraft/entity/attribute/EntityAttributeInstance;value:D
      intermediary field_23706 Lnet/minecraft/class_1324;field_23706:D
      official j Lbxj;j:D
    • updateCallback

      private final Consumer<EntityAttributeInstance> updateCallback
      Mappings:
      Namespace Name Mixin selector
      named updateCallback Lnet/minecraft/entity/attribute/EntityAttributeInstance;updateCallback:Ljava/util/function/Consumer;
      intermediary field_23707 Lnet/minecraft/class_1324;field_23707:Ljava/util/function/Consumer;
      official k Lbxj;k:Ljava/util/function/Consumer;
  • Constructor Details

    • EntityAttributeInstance

      public EntityAttributeInstance(RegistryEntry<EntityAttribute> type, Consumer<EntityAttributeInstance> updateCallback)
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/entity/attribute/EntityAttributeInstance;<init>(Lnet/minecraft/registry/entry/RegistryEntry;Ljava/util/function/Consumer;)V
      intermediary <init> Lnet/minecraft/class_1324;<init>(Lnet/minecraft/class_6880;Ljava/util/function/Consumer;)V
      official <init> Lbxj;<init>(Ljq;Ljava/util/function/Consumer;)V
  • Method Details

    • getAttribute

      public RegistryEntry<EntityAttribute> getAttribute()
      Mappings:
      Namespace Name Mixin selector
      named getAttribute Lnet/minecraft/entity/attribute/EntityAttributeInstance;getAttribute()Lnet/minecraft/registry/entry/RegistryEntry;
      intermediary method_6198 Lnet/minecraft/class_1324;method_6198()Lnet/minecraft/class_6880;
      official a Lbxj;a()Ljq;
    • getBaseValue

      public double getBaseValue()
      Gets the base value of this attribute instance. This is the value before any attribute modifiers are applied.
      Mappings:
      Namespace Name Mixin selector
      named getBaseValue Lnet/minecraft/entity/attribute/EntityAttributeInstance;getBaseValue()D
      intermediary method_6201 Lnet/minecraft/class_1324;method_6201()D
      official b Lbxj;b()D
    • setBaseValue

      public void setBaseValue(double baseValue)
      Mappings:
      Namespace Name Mixin selector
      named setBaseValue Lnet/minecraft/entity/attribute/EntityAttributeInstance;setBaseValue(D)V
      intermediary method_6192 Lnet/minecraft/class_1324;method_6192(D)V
      official a Lbxj;a(D)V
    • getModifiers

      Mappings:
      Namespace Name Mixin selector
      named getModifiers Lnet/minecraft/entity/attribute/EntityAttributeInstance;getModifiers(Lnet/minecraft/entity/attribute/EntityAttributeModifier$Operation;)Ljava/util/Map;
      intermediary method_6193 Lnet/minecraft/class_1324;method_6193(Lnet/minecraft/class_1322$class_1323;)Ljava/util/Map;
      official a Lbxj;a(Lbxl$a;)Ljava/util/Map;
    • getModifiers

      public Set<EntityAttributeModifier> getModifiers()
      Mappings:
      Namespace Name Mixin selector
      named getModifiers Lnet/minecraft/entity/attribute/EntityAttributeInstance;getModifiers()Ljava/util/Set;
      intermediary method_6195 Lnet/minecraft/class_1324;method_6195()Ljava/util/Set;
      official c Lbxj;c()Ljava/util/Set;
    • getPersistentModifiers

      public Set<EntityAttributeModifier> getPersistentModifiers()
      Mappings:
      Namespace Name Mixin selector
      named getPersistentModifiers Lnet/minecraft/entity/attribute/EntityAttributeInstance;getPersistentModifiers()Ljava/util/Set;
      intermediary method_61435 Lnet/minecraft/class_1324;method_61435()Ljava/util/Set;
      official d Lbxj;d()Ljava/util/Set;
    • getModifier

      Mappings:
      Namespace Name Mixin selector
      named getModifier Lnet/minecraft/entity/attribute/EntityAttributeInstance;getModifier(Lnet/minecraft/util/Identifier;)Lnet/minecraft/entity/attribute/EntityAttributeModifier;
      intermediary method_6199 Lnet/minecraft/class_1324;method_6199(Lnet/minecraft/class_2960;)Lnet/minecraft/class_1322;
      official a Lbxj;a(Lalz;)Lbxl;
    • hasModifier

      public boolean hasModifier(Identifier id)
      Mappings:
      Namespace Name Mixin selector
      named hasModifier Lnet/minecraft/entity/attribute/EntityAttributeInstance;hasModifier(Lnet/minecraft/util/Identifier;)Z
      intermediary method_6196 Lnet/minecraft/class_1324;method_6196(Lnet/minecraft/class_2960;)Z
      official b Lbxj;b(Lalz;)Z
    • addModifier

      private void addModifier(EntityAttributeModifier modifier)
      Mappings:
      Namespace Name Mixin selector
      named addModifier Lnet/minecraft/entity/attribute/EntityAttributeInstance;addModifier(Lnet/minecraft/entity/attribute/EntityAttributeModifier;)V
      intermediary method_6197 Lnet/minecraft/class_1324;method_6197(Lnet/minecraft/class_1322;)V
      official f Lbxj;f(Lbxl;)V
    • updateModifier

      public void updateModifier(EntityAttributeModifier modifier)
      Mappings:
      Namespace Name Mixin selector
      named updateModifier Lnet/minecraft/entity/attribute/EntityAttributeInstance;updateModifier(Lnet/minecraft/entity/attribute/EntityAttributeModifier;)V
      intermediary method_55696 Lnet/minecraft/class_1324;method_55696(Lnet/minecraft/class_1322;)V
      official a Lbxj;a(Lbxl;)V
    • addTemporaryModifier

      public void addTemporaryModifier(EntityAttributeModifier modifier)
      Adds a temporary attribute modifier. The modifier will not be serialized.
      Mappings:
      Namespace Name Mixin selector
      named addTemporaryModifier Lnet/minecraft/entity/attribute/EntityAttributeInstance;addTemporaryModifier(Lnet/minecraft/entity/attribute/EntityAttributeModifier;)V
      intermediary method_26835 Lnet/minecraft/class_1324;method_26835(Lnet/minecraft/class_1322;)V
      official b Lbxj;b(Lbxl;)V
    • overwritePersistentModifier

      public void overwritePersistentModifier(EntityAttributeModifier modifier)
      Mappings:
      Namespace Name Mixin selector
      named overwritePersistentModifier Lnet/minecraft/entity/attribute/EntityAttributeInstance;overwritePersistentModifier(Lnet/minecraft/entity/attribute/EntityAttributeModifier;)V
      intermediary method_61163 Lnet/minecraft/class_1324;method_61163(Lnet/minecraft/class_1322;)V
      official c Lbxj;c(Lbxl;)V
    • addPersistentModifier

      public void addPersistentModifier(EntityAttributeModifier modifier)
      Mappings:
      Namespace Name Mixin selector
      named addPersistentModifier Lnet/minecraft/entity/attribute/EntityAttributeInstance;addPersistentModifier(Lnet/minecraft/entity/attribute/EntityAttributeModifier;)V
      intermediary method_26837 Lnet/minecraft/class_1324;method_26837(Lnet/minecraft/class_1322;)V
      official d Lbxj;d(Lbxl;)V
    • addPersistentModifiers

      public void addPersistentModifiers(Collection<EntityAttributeModifier> modifiers)
      Mappings:
      Namespace Name Mixin selector
      named addPersistentModifiers Lnet/minecraft/entity/attribute/EntityAttributeInstance;addPersistentModifiers(Ljava/util/Collection;)V
      intermediary method_61434 Lnet/minecraft/class_1324;method_61434(Ljava/util/Collection;)V
      official a Lbxj;a(Ljava/util/Collection;)V
    • onUpdate

      protected void onUpdate()
      Mappings:
      Namespace Name Mixin selector
      named onUpdate Lnet/minecraft/entity/attribute/EntityAttributeInstance;onUpdate()V
      intermediary method_26838 Lnet/minecraft/class_1324;method_26838()V
      official e Lbxj;e()V
    • removeModifier

      public void removeModifier(EntityAttributeModifier modifier)
      Mappings:
      Namespace Name Mixin selector
      named removeModifier Lnet/minecraft/entity/attribute/EntityAttributeInstance;removeModifier(Lnet/minecraft/entity/attribute/EntityAttributeModifier;)V
      intermediary method_6202 Lnet/minecraft/class_1324;method_6202(Lnet/minecraft/class_1322;)V
      official e Lbxj;e(Lbxl;)V
    • removeModifier

      public boolean removeModifier(Identifier id)
      Mappings:
      Namespace Name Mixin selector
      named removeModifier Lnet/minecraft/entity/attribute/EntityAttributeInstance;removeModifier(Lnet/minecraft/util/Identifier;)Z
      intermediary method_6200 Lnet/minecraft/class_1324;method_6200(Lnet/minecraft/class_2960;)Z
      official c Lbxj;c(Lalz;)Z
    • clearModifiers

      public void clearModifiers()
      Mappings:
      Namespace Name Mixin selector
      named clearModifiers Lnet/minecraft/entity/attribute/EntityAttributeInstance;clearModifiers()V
      intermediary method_6203 Lnet/minecraft/class_1324;method_6203()V
      official f Lbxj;f()V
    • getValue

      public double getValue()
      Mappings:
      Namespace Name Mixin selector
      named getValue Lnet/minecraft/entity/attribute/EntityAttributeInstance;getValue()D
      intermediary method_6194 Lnet/minecraft/class_1324;method_6194()D
      official g Lbxj;g()D
    • computeValue

      private double computeValue()
      Computes this attribute's value, taking modifiers into account.

      Attribute modifiers are applied in order by operation:

      • ADD_VALUE // Adds the value of the modifier to the attribute's base value.
      • ADD_MULTIPLIED_BASE // Multiplies the value of the modifier to the attributes base value, and then adds it to the total value.
      • ADD_MULTIPLIED_TOTAL // Adds 1 to the value of the attribute modifier. Then multiplies the attribute's value by the total value of the attribute after addition and multiplication of the base value occur.
      Mappings:
      Namespace Name Mixin selector
      named computeValue Lnet/minecraft/entity/attribute/EntityAttributeInstance;computeValue()D
      intermediary method_26840 Lnet/minecraft/class_1324;method_26840()D
      official i Lbxj;i()D
    • getModifiersByOperation

      private Collection<EntityAttributeModifier> getModifiersByOperation(EntityAttributeModifier.Operation operation)
      Mappings:
      Namespace Name Mixin selector
      named getModifiersByOperation Lnet/minecraft/entity/attribute/EntityAttributeInstance;getModifiersByOperation(Lnet/minecraft/entity/attribute/EntityAttributeModifier$Operation;)Ljava/util/Collection;
      intermediary method_26834 Lnet/minecraft/class_1324;method_26834(Lnet/minecraft/class_1322$class_1323;)Ljava/util/Collection;
      official b Lbxj;b(Lbxl$a;)Ljava/util/Collection;
    • setFrom

      public void setFrom(EntityAttributeInstance other)
      Copies the values of an attribute to this attribute.

      Temporary modifiers are copied when using the operation.

      Mappings:
      Namespace Name Mixin selector
      named setFrom Lnet/minecraft/entity/attribute/EntityAttributeInstance;setFrom(Lnet/minecraft/entity/attribute/EntityAttributeInstance;)V
      intermediary method_26831 Lnet/minecraft/class_1324;method_26831(Lnet/minecraft/class_1324;)V
      official a Lbxj;a(Lbxj;)V
    • toNbt

      public NbtCompound toNbt()
      Mappings:
      Namespace Name Mixin selector
      named toNbt Lnet/minecraft/entity/attribute/EntityAttributeInstance;toNbt()Lnet/minecraft/nbt/NbtCompound;
      intermediary method_26839 Lnet/minecraft/class_1324;method_26839()Lnet/minecraft/class_2487;
      official h Lbxj;h()Lux;
    • readNbt

      public void readNbt(NbtCompound nbt)
      Mappings:
      Namespace Name Mixin selector
      named readNbt Lnet/minecraft/entity/attribute/EntityAttributeInstance;readNbt(Lnet/minecraft/nbt/NbtCompound;)V
      intermediary method_26833 Lnet/minecraft/class_1324;method_26833(Lnet/minecraft/class_2487;)V
      official a Lbxj;a(Lux;)V