Modding:Block System: Difference between revisions

From Vintage Story Wiki
no edit summary
No edit summary
No edit summary
Line 11: Line 11:
Allows nearly the same functionality of the Block class, but is very useful in avoiding code duplication. See also [[Modding:Adding_Block_Behavior|Block Behavior Class]] page.
Allows nearly the same functionality of the Block class, but is very useful in avoiding code duplication. See also [[Modding:Adding_Block_Behavior|Block Behavior Class]] page.


'''Example''': The HorizontalOrientable class for blocks that have a North/East/South/West orientation, for example the Skep. It makes sure that when the player places the block, it is oriented correctly. And when broken, it only drops only one orientation of the block so that they stay stackable. The Skep block in this case required custom code for other things, so there is a BlockSkep class. Without block behaviors, we would have needed to copy&paste the placement/breaking behaviors into the block class.
'''Example''': The HorizontalOrientable class for blocks that have a North/East/South/West orientation, for example the Skep. It makes sure that when the player places the block, it is oriented correctly. And when broken, it only drops one orientation of the block so that they stay stackable. The Skep block in this case required custom code for other things, so there is a BlockSkep class. Without block behaviors, we would have needed to copy&paste the placement/breaking behaviors into the block class.


== The BlockEntity Class ==
== The BlockEntity Class ==
Confirmedusers, Bureaucrats, editor, Administrators
1,778

edits