Modding:Block Entity: Difference between revisions

From Vintage Story Wiki
no edit summary
No edit summary
No edit summary
Line 1: Line 1:
__FORCETOC__
__FORCETOC__


= Ticking Counter =
== 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 ==


== Block Assets ==
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 ==
== 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 <code>class</code>:
<syntaxhighlight lang="json">
entityClass: "Textureflipper",
</syntaxhighlight>
== Registering the Block Entity ==
TBD


== The Mod Class ==
== The Mod Class ==
TBD


== Testing ==
== Testing ==
TBD


== Distribution ==
== Distribution ==
TBD
Confirmedusers, Bureaucrats, editor, Administrators
1,778

edits