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
Next revision
Previous revision
tutorial:blockentity [2023/09/20 19:18] – [Creating a BlockEntity] Change outdated interface notes to generic statement haykamtutorial:blockentity [2024/06/13 08:56] (current) – update outdated read nbt method s1lverposting
Line 30: Line 30:
         Registries.BLOCK_ENTITY_TYPE,         Registries.BLOCK_ENTITY_TYPE,
         new Identifier("tutorial", "demo_block_entity"),         new Identifier("tutorial", "demo_block_entity"),
-        FabricBlockEntityTypeBuilder.create(DemoBlockEntity::new, DEMO_BLOCK).build()+        BlockEntityType.Builder.create(DemoBlockEntity::new, DEMO_BLOCK).build()
     );     );
 </code> </code>
Line 72: Line 72:
     // Serialize the BlockEntity     // Serialize the BlockEntity
     @Override     @Override
-    public void writeNbt(NbtCompound nbt) {+    public void writeNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup wrapper) {
         // Save the current value of the number to the nbt         // Save the current value of the number to the nbt
         nbt.putInt("number", number);         nbt.putInt("number", number);
  
-        super.writeNbt(nbt);+        super.writeNbt(nbt, wrapper);
     }     }
 } }
Line 86: Line 86:
 // Deserialize the BlockEntity // Deserialize the BlockEntity
 @Override @Override
-public void readNbt(NbtCompound nbt) { +public void readNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup wrapper) { 
-    super.readNbt(nbt);+    super.readNbt(nbt, wrapper);
          
     number = nbt.getInt("number");     number = nbt.getInt("number");
tutorial/blockentity.txt · Last modified: 2024/06/13 08:56 by s1lverposting