Table of Contents

Struct ItemTagArray

Namespace
Vintagestory.API.Datastructures
Assembly
VintagestoryAPI.dll

List of item tags meant to be used for fast comparisons. Restricts number of registered item tags to 256.

public readonly struct ItemTagArray
Inherited Members
Extension Methods

Constructors

ItemTagArray()

public ItemTagArray()

ItemTagArray(IEnumerable<ushort>)

public ItemTagArray(IEnumerable<ushort> tags)

Parameters

tags IEnumerable<ushort>

ItemTagArray(ushort)

public ItemTagArray(ushort tag)

Parameters

tag ushort

ItemTagArray(ulong, ulong, ulong, ulong)

public ItemTagArray(ulong bitMask1, ulong bitMask2, ulong bitMask3, ulong bitMask4)

Parameters

bitMask1 ulong
bitMask2 ulong
bitMask3 ulong
bitMask4 ulong

Fields

BitMask1

public readonly ulong BitMask1

Field Value

ulong

BitMask2

public readonly ulong BitMask2

Field Value

ulong

BitMask3

public readonly ulong BitMask3

Field Value

ulong

BitMask4

public readonly ulong BitMask4

Field Value

ulong

Empty

public static readonly ItemTagArray Empty

Field Value

ItemTagArray

MasksNumber

public const byte MasksNumber = 4

Field Value

byte

Size

Maximum amount of different tags supported by tag array. Limited by total amount of bits in bit masks.

public const int Size = 256

Field Value

int

Methods

And(ItemTagArray, ItemTagArray)

public static ItemTagArray And(ItemTagArray first, ItemTagArray second)

Parameters

first ItemTagArray
second ItemTagArray

Returns

ItemTagArray

ContainsAll(ItemTagArray)

Checks if this tag array contains all tags from other

public bool ContainsAll(ItemTagArray other)

Parameters

other ItemTagArray

Returns

bool

ContainsAllFromAtLeastOne(ItemTagArray[])

Checks if this tag array contains all tags from at least one element of tags

public bool ContainsAllFromAtLeastOne(ItemTagArray[] tags)

Parameters

tags ItemTagArray[]

Returns

bool

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

FromBytes(BinaryReader)

public static ItemTagArray FromBytes(BinaryReader reader)

Parameters

reader BinaryReader

Returns

ItemTagArray

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

Intersect(ItemTagArray)

Checks if this tag array has at least one common tag with other

public bool Intersect(ItemTagArray other)

Parameters

other ItemTagArray

Returns

bool

Intersect(ItemTagArray, ItemTagArray)

Checks if two tag arrays have at least one common tag

public static bool Intersect(ItemTagArray first, ItemTagArray second)

Parameters

first ItemTagArray
second ItemTagArray

Returns

bool

IntersectsWithEach(ItemTagArray[])

Checks if this tag array contains at least on tag from each element of tags

public bool IntersectsWithEach(ItemTagArray[] tags)

Parameters

tags ItemTagArray[]

Returns

bool

Not(ItemTagArray)

public static ItemTagArray Not(ItemTagArray value)

Parameters

value ItemTagArray

Returns

ItemTagArray

Or(ItemTagArray, ItemTagArray)

public static ItemTagArray Or(ItemTagArray first, ItemTagArray second)

Parameters

first ItemTagArray
second ItemTagArray

Returns

ItemTagArray

ToArray()

Converts tag array into list of tag ids sorted in ascending order

public IEnumerable<ushort> ToArray()

Returns

IEnumerable<ushort>

List of tag ids in ascending order

ToArray(ICoreAPI)

Converts tag array into list of tags.

public IEnumerable<string> ToArray(ICoreAPI api)

Parameters

api ICoreAPI

Returns

IEnumerable<string>

ToBytes(BinaryWriter)

public void ToBytes(BinaryWriter writer)

Parameters

writer BinaryWriter

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Operators

operator &(ItemTagArray, ItemTagArray)

public static ItemTagArray operator &(ItemTagArray first, ItemTagArray second)

Parameters

first ItemTagArray
second ItemTagArray

Returns

ItemTagArray

operator |(ItemTagArray, ItemTagArray)

public static ItemTagArray operator |(ItemTagArray first, ItemTagArray second)

Parameters

first ItemTagArray
second ItemTagArray

Returns

ItemTagArray

operator ==(ItemTagArray, ItemTagArray)

public static bool operator ==(ItemTagArray first, ItemTagArray second)

Parameters

first ItemTagArray
second ItemTagArray

Returns

bool

operator !=(ItemTagArray, ItemTagArray)

public static bool operator !=(ItemTagArray first, ItemTagArray second)

Parameters

first ItemTagArray
second ItemTagArray

Returns

bool

operator ~(ItemTagArray)

public static ItemTagArray operator ~(ItemTagArray value)

Parameters

value ItemTagArray

Returns

ItemTagArray