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 revisionPrevious revision
tutorial:blockentity [2023/06/03 17:57] – fixed typos terratutorial:blockentity [2023/09/20 19:18] (current) – [Creating a BlockEntity] Change outdated interface notes to generic statement haykam
Line 19: Line 19:
 Please ensure that the constructor only takes the two parameters, otherwise the method reference ''DemoBlockEntity::new'' that we write later will be invalid. The ''ExampleMod.DEMO_BLOCK_ENTITY'' field will be created later. Please ensure that the constructor only takes the two parameters, otherwise the method reference ''DemoBlockEntity::new'' that we write later will be invalid. The ''ExampleMod.DEMO_BLOCK_ENTITY'' field will be created 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. +Block entities support a variety of methods to enable functionality such as serialization to and deserialization from NBT, ticking, providing inventories, and more. This tutorial covers the most common implementations of block entity functionality.
 ===== Registering your BlockEntity ===== ===== Registering your BlockEntity =====
  
tutorial/blockentity.txt · Last modified: 2023/09/20 19:18 by haykam