Class BlockDropItemStack
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
Represents an itemstack that is dropped by chance when breaking a block
public class BlockDropItemStack
- Inheritance
-
BlockDropItemStack
- Inherited Members
Constructors
BlockDropItemStack()
public BlockDropItemStack()
BlockDropItemStack(ItemStack, float)
public BlockDropItemStack(ItemStack stack, float chance = 1)
Parameters
Fields
Attributes
Tree Attributes that should be attached to the resulting itemstack
[JsonProperty]
[JsonConverter(typeof(JsonAttributesConverter))]
public JsonObject Attributes
Field Value
Code
Code of the block or item
public AssetLocation Code
Field Value
DropModbyStat
If set, the drop quantity will be modified by the collecting entity stat code - entity.Stats.GetBlended(code)
public string DropModbyStat
Field Value
LastDrop
If true and the quantity dropped is >=1 any subsequent drop will be ignored
public bool LastDrop
Field Value
Quantity
Quantity to be dropped
public NatFloat Quantity
Field Value
ResolvedItemstack
The resulting ItemStack for this block being broken by a tool.
public ItemStack ResolvedItemstack
Field Value
Tool
If not null then given tool is required to break this block
public EnumTool? Tool
Field Value
Type
Block or Item?
public EnumItemClass Type
Field Value
Methods
Clone()
Creates a deep copy of this object
public BlockDropItemStack Clone()
Returns
FromBytes(BinaryReader, IClassRegistryAPI)
Reads the contents of the block bytes and converts it into a block.
public virtual void FromBytes(BinaryReader reader, IClassRegistryAPI instancer)
Parameters
reader
BinaryReaderThe reader of the block
instancer
IClassRegistryAPIThe block registry
GetNextItemStack(float)
Returns an itemstack with random quantity as configured via the Quantity field
public ItemStack GetNextItemStack(float dropQuantityMultiplier = 1)
Parameters
dropQuantityMultiplier
float
Returns
Resolve(IWorldAccessor, string, AssetLocation)
Sets itemstack.block or itemstack.item
public bool Resolve(IWorldAccessor resolver, string sourceForErrorLogging, AssetLocation assetLoc)
Parameters
resolver
IWorldAccessorsourceForErrorLogging
stringassetLoc
AssetLocation
Returns
ToBytes(BinaryWriter)
The save data writer.
public virtual void ToBytes(BinaryWriter writer)
Parameters
writer
BinaryWriterThe writer to write blocks to.