User Tools

Site Tools


tutorial:containers

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
tutorial:containers [2020/02/27 16:19] – [Orgnizing] typo mkpolitutorial:containers [2020/02/27 16:26] – use an alternate uncasting way mkpoli
Line 252: Line 252:
         [...]         [...]
         ContainerProviderRegistry.INSTANCE.registerFactory(BIGGER_CHEST, (syncId, identifier, player, buf) -> {         ContainerProviderRegistry.INSTANCE.registerFactory(BIGGER_CHEST, (syncId, identifier, player, buf) -> {
-            final BlockEntity blockEntity = player.world.getBlockEntity(buf.readBlockPos()); +            final World world = player.world
-            return((BiggerChestBlockEntityblockEntity).createContainer(syncId, player.inventory);+            final BlockPos pos = buf.readBlockPos(); 
 +            return world.getBlockState(pos).createContainerFactory(player.world, pos).createMenu(syncId, player.inventory, player);
         });         });
     }     }
tutorial/containers.txt · Last modified: 2022/05/27 15:57 by solidblock