Table of Contents

Class JsonItemStack

Namespace
Vintagestory.API.Common
Assembly
VintagestoryAPI.dll
[ProtoContract]
public class JsonItemStack : IRecipeOutput
Inheritance
JsonItemStack
Implements
Inherited Members

Fields

Attributes

Tree Attributes that should be attached to the resulting itemstack

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

Field Value

JsonObject

Code

Code of the block or item

[ProtoMember(2)]
public AssetLocation Code

Field Value

AssetLocation

ResolvedItemstack

The resolved item after conversion.

public ItemStack ResolvedItemstack

Field Value

ItemStack

StackSize

Amount of items in this stacks

[ProtoMember(3)]
public int StackSize

Field Value

int

Type

Block or Item?

[ProtoMember(1)]
public EnumItemClass Type

Field Value

EnumItemClass

Properties

Quantity

Alias of StackSize

public int Quantity { get; set; }

Property Value

int

Methods

Clone()

Creates a deep copy of this object

public JsonItemStack Clone()

Returns

JsonItemStack

FillPlaceHolder(string, string)

public void FillPlaceHolder(string key, string value)

Parameters

key string
value string

FromBytes(BinaryReader, IClassRegistryAPI)

Loads the ItemStack from the reader.

public virtual void FromBytes(BinaryReader reader, IClassRegistryAPI instancer)

Parameters

reader BinaryReader

The reader to get the ItemStack from

instancer IClassRegistryAPI

The instancer for the ItemStack.

FromString(string)

public static JsonItemStack FromString(string jsonItemstack)

Parameters

jsonItemstack string

Returns

JsonItemStack

Matches(IWorldAccessor, ItemStack)

public bool Matches(IWorldAccessor worldForResolve, ItemStack inputStack)

Parameters

worldForResolve IWorldAccessor
inputStack ItemStack

Returns

bool

Resolve(IWorldAccessor, string, bool)

public bool Resolve(IWorldAccessor resolver, string sourceForErrorLogging, bool printWarningOnError = true)

Parameters

resolver IWorldAccessor
sourceForErrorLogging string
printWarningOnError bool

Returns

bool

Resolve(IWorldAccessor, string, AssetLocation, bool)

Sets itemstack.block or itemstack.item

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

Parameters

resolver IWorldAccessor
sourceForErrorLogging string
assetLoc AssetLocation
printWarningOnError bool

Returns

bool

ToBytes(BinaryWriter)

Saves the ItemStack to file.

public virtual void ToBytes(BinaryWriter writer)

Parameters

writer BinaryWriter

The writer to save the item to.