public class EntityAttributeInstance extends Object
Modifier and Type | Field and Description |
---|---|
private double |
baseValue |
private Map<UUID,EntityAttributeModifier> |
byId |
private boolean |
dirty |
private Map<EntityAttributeModifier.Operation,Set<EntityAttributeModifier>> |
operationToModifiers |
private Set<EntityAttributeModifier> |
persistentModifiers |
private EntityAttribute |
type |
private Consumer<EntityAttributeInstance> |
updateCallback |
private double |
value |
Constructor and Description |
---|
EntityAttributeInstance(EntityAttribute type,
Consumer<EntityAttributeInstance> updateCallback) |
Modifier and Type | Method and Description |
---|---|
private void |
addModifier(EntityAttributeModifier modifier) |
void |
addPersistentModifier(EntityAttributeModifier modifier) |
void |
addTemporaryModifier(EntityAttributeModifier modifier) |
void |
clearModifiers() |
private double |
computeValue() |
void |
fromTag(CompoundTag tag) |
EntityAttribute |
getAttribute() |
double |
getBaseValue() |
EntityAttributeModifier |
getModifier(UUID uuid) |
Set<EntityAttributeModifier> |
getModifiers() |
Set<EntityAttributeModifier> |
getModifiers(EntityAttributeModifier.Operation operation) |
private Collection<EntityAttributeModifier> |
getModifiersByOperation(EntityAttributeModifier.Operation operation) |
double |
getValue() |
boolean |
hasModifier(EntityAttributeModifier modifier) |
protected void |
onUpdate() |
void |
removeModifier(EntityAttributeModifier modifier) |
void |
removeModifier(UUID uuid) |
void |
setBaseValue(double baseValue) |
void |
setFrom(EntityAttributeInstance other) |
CompoundTag |
toTag() |
private final EntityAttribute type
private final Map<EntityAttributeModifier.Operation,Set<EntityAttributeModifier>> operationToModifiers
private final Map<UUID,EntityAttributeModifier> byId
private final Set<EntityAttributeModifier> persistentModifiers
private double baseValue
private boolean dirty
private double value
private final Consumer<EntityAttributeInstance> updateCallback
public EntityAttributeInstance(EntityAttribute type, Consumer<EntityAttributeInstance> updateCallback)
public EntityAttribute getAttribute()
public double getBaseValue()
public void setBaseValue(double baseValue)
public Set<EntityAttributeModifier> getModifiers(EntityAttributeModifier.Operation operation)
public Set<EntityAttributeModifier> getModifiers()
@Nullable public EntityAttributeModifier getModifier(UUID uuid)
public boolean hasModifier(EntityAttributeModifier modifier)
private void addModifier(EntityAttributeModifier modifier)
public void addTemporaryModifier(EntityAttributeModifier modifier)
public void addPersistentModifier(EntityAttributeModifier modifier)
protected void onUpdate()
public void removeModifier(EntityAttributeModifier modifier)
public void removeModifier(UUID uuid)
@Environment(value=CLIENT) public void clearModifiers()
public double getValue()
private double computeValue()
private Collection<EntityAttributeModifier> getModifiersByOperation(EntityAttributeModifier.Operation operation)
public void setFrom(EntityAttributeInstance other)
public CompoundTag toTag()
public void fromTag(CompoundTag tag)