User Tools

Site Tools


tutorial:blockentity

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
tutorial:blockentity [2020/05/07 18:53]
yanis48 typo
tutorial:blockentity [2020/05/07 19:15] (current)
earthcomputer [Registring your BlockEntity] Fix typo in section header
Line 21: Line 21:
 You can simply add variables to this barebone class or implement interfaces such as ''​Tickable''​ and ''​Inventory''​ to add more functionality. ''​Tickable''​ provides a single ''​tick()''​ method, which is called once per tick for every loaded instance of your Block in the world., while ''​Inventory''​ allows your BlockEntity to interact with automation such as hoppers - there will likely be a separate tutorial dedicated entirely to this interface later. You can simply add variables to this barebone class or implement interfaces such as ''​Tickable''​ and ''​Inventory''​ to add more functionality. ''​Tickable''​ provides a single ''​tick()''​ method, which is called once per tick for every loaded instance of your Block in the world., while ''​Inventory''​ allows your BlockEntity to interact with automation such as hoppers - there will likely be a separate tutorial dedicated entirely to this interface later.
  
-===== Registring ​your BlockEntity =====+===== Registering ​your BlockEntity =====
  
 Once you have created the ''​BlockEntity''​ class, you will need to register it for it to function. The first step of this process is to create a ''​BlockEntityType'',​ which links your ''​Block''​ and ''​BlockEntity''​ together. Assuming your ''​Block''​ has been created and saved to a local variable ''​DEMO_BLOCK'',​ you would create the matching ''​BlockEntityType''​ with the line below. ''​modid:​demo''​ should be replaced by your Mod ID and the name you want your ''​BlockEntity''​ to be registered under. Once you have created the ''​BlockEntity''​ class, you will need to register it for it to function. The first step of this process is to create a ''​BlockEntityType'',​ which links your ''​Block''​ and ''​BlockEntity''​ together. Assuming your ''​Block''​ has been created and saved to a local variable ''​DEMO_BLOCK'',​ you would create the matching ''​BlockEntityType''​ with the line below. ''​modid:​demo''​ should be replaced by your Mod ID and the name you want your ''​BlockEntity''​ to be registered under.
tutorial/blockentity.txt ยท Last modified: 2020/05/07 19:15 by earthcomputer