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
Fields
BitMask1
public readonly ulong BitMask1
Field Value
BitMask2
public readonly ulong BitMask2
Field Value
BitMask3
public readonly ulong BitMask3
Field Value
BitMask4
public readonly ulong BitMask4
Field Value
Empty
public static readonly ItemTagArray Empty
Field Value
MasksNumber
public const byte MasksNumber = 4
Field Value
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
Methods
And(ItemTagArray, ItemTagArray)
public static ItemTagArray And(ItemTagArray first, ItemTagArray second)
Parameters
first
ItemTagArraysecond
ItemTagArray
Returns
ContainsAll(ItemTagArray)
Checks if this tag array contains all tags from other
public bool ContainsAll(ItemTagArray other)
Parameters
other
ItemTagArray
Returns
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
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
obj
objectThe 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
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
Intersect(ItemTagArray, ItemTagArray)
Checks if two tag arrays have at least one common tag
public static bool Intersect(ItemTagArray first, ItemTagArray second)
Parameters
first
ItemTagArraysecond
ItemTagArray
Returns
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
Not(ItemTagArray)
public static ItemTagArray Not(ItemTagArray value)
Parameters
value
ItemTagArray
Returns
Or(ItemTagArray, ItemTagArray)
public static ItemTagArray Or(ItemTagArray first, ItemTagArray second)
Parameters
first
ItemTagArraysecond
ItemTagArray
Returns
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
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
ItemTagArraysecond
ItemTagArray
Returns
operator |(ItemTagArray, ItemTagArray)
public static ItemTagArray operator |(ItemTagArray first, ItemTagArray second)
Parameters
first
ItemTagArraysecond
ItemTagArray
Returns
operator ==(ItemTagArray, ItemTagArray)
public static bool operator ==(ItemTagArray first, ItemTagArray second)
Parameters
first
ItemTagArraysecond
ItemTagArray
Returns
operator !=(ItemTagArray, ItemTagArray)
public static bool operator !=(ItemTagArray first, ItemTagArray second)
Parameters
first
ItemTagArraysecond
ItemTagArray
Returns
operator ~(ItemTagArray)
public static ItemTagArray operator ~(ItemTagArray value)
Parameters
value
ItemTagArray