API reference Obsidian.API.Blocks
BlockType class
A block a plugin registered with IPluginRegistry.RegisterBlock, and its states.
public sealed class BlockType
In Obsidian.API.
Remarks
The server owns the block: it keeps its instance, identifier and ids, block and state, until the server stops, even when the plugin reloads or unloads; a reload replaces only its properties and behaviour.
Properties
DefaultState
public IBlock DefaultState { get; }The state the block is placed in.
FirstStateId
public int FirstStateId { get; }The id of the block's first state. Its states' ids follow each other, after every state of the blocks before it.
Id
public int Id { get; }The block's id in the block registry. Vanilla's come first; plugins' follow, in the order they were first registered.
Identifier
public string Identifier { get; }The block's identifier, like myplugin:ruby_block.
Item
public Item Item { get; }The block's item, or null if it has none.
Owner
public IPluginContainer Owner { get; }The plugin that registered the block and provides its behaviour, or null while the plugin is unloaded.
Properties
public ImmutableArray<StateProperty> Properties { get; }The properties the block's states vary by, sorted by name.
SoundType
public BlockSoundProperties SoundType { get; }The currently loaded plugin's sound type, or stone when the plugin is unloaded.
StateCount
public int StateCount { get; }How many states the block has, one per combination of its properties' values.
Methods
GetState(IReadOnlyDictionary<string, string>)
public IBlock GetState(IReadOnlyDictionary<string, string> values);The state with the given property values; a property not given keeps the default state's value.
GetValue(IBlock, string)
public string GetValue(IBlock state, string property);A property's value in one of the block's states.
Is(IBlock)
public bool Is(IBlock block);Whether block is one of this block's states.
public override string ToString();With(IBlock, string, string)
public IBlock With(IBlock state, string property, string value);The same state with property set to value.
Fields
MaxStates
public const int MaxStates = 4096;The most states a block may have; vanilla's block with the most has 1296.