Modding:Block Entity

From Vintage Story Wiki
Revision as of 10:51, 10 September 2017 by Tyron (talk | contribs)


Introduction

A block entity is a construct that you can tack onto an existing block to give it additional functionality. Whenever a block should do something on a regular interval or store extra information, such as the contents of a chest block, you need a block entity.

The Texture Flipper

Let's take our Basic block that we already created and make it flip between a gold and silver texture every 3 seconds. We'll use "Textureflipper" as our unique identifier for this new block entity.

The BlockEntity

TBD

Attaching the Block Entity

Open the blocktype json file and add the following line. This will attach the block entity-to-be to our block.

The only new property is the class:

	entityClass: "Textureflipper",

Registering the Block Entity

TBD

The Mod Class

TBD

Testing

TBD

Distribution

TBD