tutorial:containers
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
tutorial:containers [2020/02/27 13:45] – Update BlockEntity part mkpoli | tutorial:containers [2020/02/27 16:26] – use an alternate uncasting way mkpoli | ||
---|---|---|---|
Line 88: | Line 88: | ||
BlockEntities are used for managing container inventories. Actually, it implements Inventory interface. | BlockEntities are used for managing container inventories. Actually, it implements Inventory interface. | ||
- | <code java [enable_line_numbers=" | + | <code java [enable_line_numbers=" |
public class BiggerChestBlockEntity extends LootableContainerBlockEntity { | public class BiggerChestBlockEntity extends LootableContainerBlockEntity { | ||
private DefaultedList< | private DefaultedList< | ||
Line 252: | Line 252: | ||
[...] | [...] | ||
ContainerProviderRegistry.INSTANCE.registerFactory(BIGGER_CHEST, | ContainerProviderRegistry.INSTANCE.registerFactory(BIGGER_CHEST, | ||
- | final BlockEntity blockEntity | + | final World world = player.world; |
- | return((BiggerChestBlockEntity) blockEntity).createContainer(syncId, player.inventory); | + | final BlockPos pos = buf.readBlockPos(); |
+ | return | ||
}); | }); | ||
} | } | ||
Line 265: | Line 266: | ||
</ | </ | ||
- | ==== Orgnizing | + | ==== Organizing |
After all the steps, you should have your ExampleMod Class and ExampleClientMod Class as such: | After all the steps, you should have your ExampleMod Class and ExampleClientMod Class as such: | ||
tutorial/containers.txt · Last modified: 2022/05/27 15:57 by solidblock