Skip to content

Block

A block is an individual representation of a Voxel, its appearance, and physical properties. A group of blocks forms a Chunk. (Usually 16x16x16). Many chunks form the World.

Blocks implement the IBlock interface, usually via BlockBase, or one of its successors (eg EarthBase or EssentialsBlock)

Creating a Block

To start off, create a new file, and name it of your block type. Then decorate it with the Block attribute. Example:

Blocks require, at minimum, you define the Name and the TextureResource. You may also have to inject the IResourceResolver instance via Plugin Dependencies.

The Block Attribute tells core what the internal name of the block is. This is how we identify it in save files and across the network to the server.

[Block("SpecialDirt")]
public class DirtBlock
{
  public override string Name{
    get{ return "Special Dirt"; }
  }

  public override string TextureResource{
    get{ return this.ResourceResolver.Resolve("textures/mytexture.png"); }
  }
}