Class EntityItem
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
public class EntityItem : Entity
- Inheritance
-
EntityItem
- Inherited Members
- Extension Methods
Constructors
EntityItem()
public EntityItem()
Fields
Slot
public EntityItemSlot Slot
Field Value
itemSpawnedMilliseconds
public long itemSpawnedMilliseconds
Field Value
Properties
ByPlayerUid
The UID of the player that dropped this itemstack.
public string ByPlayerUid { get; set; }
Property Value
IsInteractable
Whether or not the EntityItem is interactable.
public override bool IsInteractable { get; }
Property Value
Itemstack
The itemstack attached to this Item Entity.
public ItemStack Itemstack { get; set; }
Property Value
LightHsv
Get the HSV colors for the lighting.
public override byte[] LightHsv { get; }
Property Value
- byte[]
MaterialDensity
Returns the material density of the item.
public override float MaterialDensity { get; }
Property Value
SwimmingOffsetY
Used for passive physics simulation, together with the MaterialDensity to check how deep in the water the entity should float
public override double SwimmingOffsetY { get; }
Property Value
Methods
CanCollect(Entity)
Should return true if this item can be picked up as an itemstack
public override bool CanCollect(Entity byEntity)
Parameters
byEntity
Entity
Returns
Die(EnumDespawnReason, DamageSource)
Makes the entity despawn. Entities only drop something on EnumDespawnReason.Death
public override void Die(EnumDespawnReason reason = EnumDespawnReason.Death, DamageSource damageSourceForDeath = null)
Parameters
reason
EnumDespawnReasondamageSourceForDeath
DamageSource
FromBytes(BinaryReader, bool)
Loads the entity from a stored byte array from the SaveGame
public override void FromBytes(BinaryReader reader, bool forClient)
Parameters
reader
BinaryReaderforClient
bool
FromItemstack(ItemStack, Vec3d, Vec3d, IWorldAccessor)
Builds and spawns an EntityItem from a provided ItemStack.
public static EntityItem FromItemstack(ItemStack itemstack, Vec3d position, Vec3d velocity, IWorldAccessor world)
Parameters
itemstack
ItemStackThe contents of the EntityItem
position
Vec3dThe position of the EntityItem
velocity
Vec3dThe velocity of the EntityItem
world
IWorldAccessorThe world the EntityItems preside in.
Returns
- EntityItem
A freshly baked EntityItem to introduce to the world.
Ignite()
public override void Ignite()
Initialize(EntityProperties, ICoreAPI, long)
Called when this entity got created or loaded
public override void Initialize(EntityProperties properties, ICoreAPI api, long chunkindex3d)
Parameters
properties
EntityPropertiesapi
ICoreAPIchunkindex3d
long
OnCollected(Entity)
Called by BehaviorCollectEntities of nearby entities. Should return the itemstack that should be collected. If the item stack was fully picked up, BehaviorCollectEntities will kill this entity
public override ItemStack OnCollected(Entity byEntity)
Parameters
byEntity
Entity
Returns
OnEntityDespawn(EntityDespawnData)
Called when the entity despawns
public override void OnEntityDespawn(EntityDespawnData despawn)
Parameters
despawn
EntityDespawnData
OnGameTick(float)
Called every 1/75 second
public override void OnGameTick(float dt)
Parameters
dt
float
OnReceivedServerAnimations(int[], int, float[])
public override void OnReceivedServerAnimations(int[] activeAnimations, int activeAnimationsCount, float[] activeAnimationSpeeds)
Parameters
ReceiveDamage(DamageSource, float)
Called when the entity should be receiving damage from given source
public override bool ReceiveDamage(DamageSource damageSource, float damage)
Parameters
damageSource
DamageSourcedamage
float
Returns
- bool
True if the entity actually received damage
ShouldReceiveDamage(DamageSource, float)
Should return true if the entity can get damaged by given damageSource. Is called by ReceiveDamage.
public override bool ShouldReceiveDamage(DamageSource damageSource, float damage)
Parameters
damageSource
DamageSourcedamage
float
Returns
StartAnimation(string)
Starts the animation for the entity.
public override void StartAnimation(string code)
Parameters
code
string
StopAnimation(string)
stops the animation for the entity.
public override void StopAnimation(string code)
Parameters
code
string
UpdateDebugAttributes()
Updates the DebugAttributes tree
public override void UpdateDebugAttributes()