Class EntityStats
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
public class EntityStats : IEnumerable<KeyValuePair<string, EntityFloatStats>>, IEnumerable
- Inheritance
-
EntityStats
- Implements
- Inherited Members
- Extension Methods
Constructors
EntityStats(Entity)
public EntityStats(Entity entity)
Parameters
entityEntity
Properties
this[string]
public EntityFloatStats this[string key] { get; set; }
Parameters
keystring
Property Value
Methods
FromTreeAttributes(ITreeAttribute)
public void FromTreeAttributes(ITreeAttribute tree)
Parameters
treeITreeAttribute
GetBlended(string)
Get the final stat value, blended by the stats blend type
public float GetBlended(string category)
Parameters
categorystring
Returns
GetEnumerator()
public IEnumerator<KeyValuePair<string, EntityFloatStats>> GetEnumerator()
Returns
Initialize(ICoreAPI)
public void Initialize(ICoreAPI api)
Parameters
apiICoreAPI
Register(string, EnumStatBlendType)
Set up a stat. Its not required to call this method, you can go straight to doing .Set() if your blend type is weighted sum. Also initializes a base value of 1.
public EntityStats Register(string category, EnumStatBlendType blendType = EnumStatBlendType.WeightedSum)
Parameters
categorystringblendTypeEnumStatBlendType
Returns
Remove(string, string)
Remove a stat value
public EntityStats Remove(string category, string code)
Parameters
Returns
Set(string, string, float, bool)
Set a stat value, if the stat catgory does not exist, it will create a new default one. Initializes a base value of 1 when creating a new stat.
public EntityStats Set(string category, string code, float value, bool persistent = false)
Parameters
Returns
ToTreeAttributes(ITreeAttribute, bool)
public void ToTreeAttributes(ITreeAttribute tree, bool forClient)
Parameters
treeITreeAttributeforClientbool