Table of Contents

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

stack ItemStack
chance float

Fields

Attributes

Tree Attributes that should be attached to the resulting itemstack

[JsonProperty]
[JsonConverter(typeof(JsonAttributesConverter))]
public JsonObject Attributes

Field Value

JsonObject

Code

Code of the block or item

public AssetLocation Code

Field Value

AssetLocation

DropModbyStat

If set, the drop quantity will be modified by the collecting entity stat code - entity.Stats.GetBlended(code)

public string DropModbyStat

Field Value

string

LastDrop

If true and the quantity dropped is >=1 any subsequent drop will be ignored

public bool LastDrop

Field Value

bool

Quantity

Quantity to be dropped

public NatFloat Quantity

Field Value

NatFloat

ResolvedItemstack

The resulting ItemStack for this block being broken by a tool.

public ItemStack ResolvedItemstack

Field Value

ItemStack

Tool

If not null then given tool is required to break this block

public EnumTool? Tool

Field Value

EnumTool?

Type

Block or Item?

public EnumItemClass Type

Field Value

EnumItemClass

Methods

Clone()

Creates a deep copy of this object

public BlockDropItemStack Clone()

Returns

BlockDropItemStack

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 BinaryReader

The reader of the block

instancer IClassRegistryAPI

The 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

ItemStack

Resolve(IWorldAccessor, string, AssetLocation)

Sets itemstack.block or itemstack.item

public bool Resolve(IWorldAccessor resolver, string sourceForErrorLogging, AssetLocation assetLoc)

Parameters

resolver IWorldAccessor
sourceForErrorLogging string
assetLoc AssetLocation

Returns

bool

ToBytes(BinaryWriter)

The save data writer.

public virtual void ToBytes(BinaryWriter writer)

Parameters

writer BinaryWriter

The writer to write blocks to.