Table of Contents

Namespace Vintagestory.API.Datastructures

Classes

ArrayAttribute<T>
BoolArrayAttribute

Open in GitHub

BoolAttribute

Open in GitHub

BoolRef

Open in GitHub

Bools

Open in GitHub

ByteArrayAttribute

Open in GitHub

CachedCuboidList

Open in GitHub

CachedCuboidListFaster

Just like CachedCuboidList except we use structs internally, for RAM access performance. We leave CachedCuboidList just as it is for mod backwards compatibility Open in GitHub

CachingConcurrentDictionary<TKey, TValue>

Exactly like ConcurrentDictionary except that Values is cached for performance, instead of building a new List each time Values is accessed

The cache is only guaranteed up to date if CachedConcurrentDictionary.TryAdd, .TryRemove or [] methods are used to modify the Dictionary otherwise the cache will be updated next time when one of those methods is used

DictionaryExtensions

Open in GitHub

DoubleArrayAttribute

Open in GitHub

DoubleAttribute

Open in GitHub

FastLargeSetOfLongs

Open in GitHub

FastListEnum<TElem>
FastList<TElem>

Does not clear elements in Clear(), but only sets the Count to 0

FastMemoryStream

Open in GitHub

FastSetOfInts

Open in GitHub

FastSetOfLongs

Open in GitHub

FastSmallDictionary<TKey, TValue>

A fast implementation of IDictionary using arrays. Only suitable for small dictionaries, typically 1-20 entries.
Note that Add is implemented differently from a standard Dictionary, it does not check that the key is not already present (and does not throw an ArgumentException)
Additional methods AddIfNotPresent() and Clone() are provided for convenience. There are also additional convenient constructors

FloatArrayAttribute

Open in GitHub

FloatAttribute

Open in GitHub

FloatDataMap3D

A datastructure to hold 3 dimensional data in the form of floats Can be used to perfrom trilinear interpolation between individual values Open in GitHub

IntArrayAttribute

Open in GitHub

IntAttribute

Open in GitHub

IntDataMap2D

A datastructure to hold 2 dimensional data in the form of ints. Can be used to perfrom bilinear interpolation between individual values Open in GitHub

IntRef

Open in GitHub

ItemstackAttribute

Open in GitHub

JsonObject

Elegant, yet somewhat inefficently designed (because wasteful with heap objects) wrapper class to abstract away the type-casting nightmare of JToken O.O Open in GitHub

JsonTreeAttribute

Open in GitHub

LimitedDictionary<TKey, TValue>

Can only hold a limited amount of elements, discards oldest elements once the capacity is reached.

LimitedList<TElem>

Holds a limited amount of items, discards the lowest index item when an overflow happens

ListDictionary<TKey, TValue>
LongArrayAttribute

Open in GitHub

LongAttribute

Open in GitHub

OrderedDictionary<TKey, TValue>

Same as your normal C# Dictionary but ensures that the order in which the items are added is remembered. That way you can iterate over the dictionary with the insert order intact or set/get elements by index. Taken from http://www.codeproject.com/Articles/18615/OrderedDictionary-T-A-generic-implementation-of-IO Please be aware that this is not a very efficient implementation, recommed use only for small sets of data.

QueueOfInt

Open in GitHub

Rectangled

Open in GitHub

Rectanglef

Open in GitHub

RingArray<T>
RotatableCube

A rotatable version of a cuboid. Open in GitHub

ScalarAttribute<T>
SortableQueue<T>
StackMatrix4

Open in GitHub

StreamedByteArrayAttribute

When serialized, produces identical byte output to a ByteArrayAttribute. The difference is, for performance, this writes directly to the provided BinaryWriter stream
Intended to be deserialized to a ByteArrayAttribute Open in GitHub

StreamedTreeAttribute

Open in GitHub

StringArrayAttribute

Open in GitHub

StringAttribute

Open in GitHub

SyncedTreeAttribute

Open in GitHub

TreeArrayAttribute

Open in GitHub

TreeAttribute

A datastructure to hold generic data for most primitives (int, string, float, etc.). But can also hold generic data using the ByteArrayAttribute + class serialization Open in GitHub

TreeAttributeUtil

Open in GitHub

TreeModifiedListener

Open in GitHub

UniqueQueue<T>

Same as your normal c# queue but ensures that every element is contained only once using a Hashset.

Structs

BlockTagArray

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

BlockTagRule

Pair of tag arrays that is used for implementation of tag inversion

EntityTagArray

List of entity tags meant to be used for fast comparisons. Restricts number of registered entity tags to 128

EntityTagRule

Pair of tag arrays that is used for implementation of tag inversion for entity ai tasks

ItemTagArray

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

ItemTagRule

Pair of tag arrays that is used for implementation of tag inversion

SmallBoolArray

Suitable for up to 32 bool values, though normally used only for 6. Offers most of the methods available for a bool[], so can be dropped in to existing code

Interfaces

IAttribute

An attribute from an attribute tree

IMergeable<T>
IOrderedDictionary<TKey, TValue>

Represents a generic collection of key/value pairs that are ordered independently of the key and value.

ITreeAttribute

Represents a List of nestable Attributes

Enums

EnumAttributeType

Open in GitHub