tutorial:containers
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tutorial:containers [2020/08/14 07:09] – screen handlers part 2, needs extra testing leocth2 | tutorial:containers [2022/05/27 15:57] (current) – solidblock | ||
|---|---|---|---|
| Line 50: | Line 50: | ||
| BlockEntity blockEntity = world.getBlockEntity(pos); | BlockEntity blockEntity = world.getBlockEntity(pos); | ||
| if (blockEntity instanceof BiggerChestBlockEntity) { | if (blockEntity instanceof BiggerChestBlockEntity) { | ||
| - | ItemScatterer.spawn(world, | + | ItemScatterer.spawn(world, |
| // update comparators | // update comparators | ||
| world.updateHorizontalAdjacent(pos, | world.updateHorizontalAdjacent(pos, | ||
| Line 81: | Line 81: | ||
| public static final Identifier BIGGER_CHEST = new Identifier(MOD_ID, | public static final Identifier BIGGER_CHEST = new Identifier(MOD_ID, | ||
| - | public static final Block BIGGER_CHEST_BLOCK = new BiggerChestBlock(FabricBlockSettings.of(Material.METAL).build()); | + | public static final Block BIGGER_CHEST_BLOCK = new BiggerChestBlock(FabricBlockSettings.of(Material.METAL)); |
| @Override | @Override | ||
| Line 87: | Line 87: | ||
| { | { | ||
| Registry.register(Registry.BLOCK, | Registry.register(Registry.BLOCK, | ||
| - | Registry.register(Registry.BLOCK, BIGGER_CHEST, | + | Registry.register(Registry.ITEM, BIGGER_CHEST, |
| } | } | ||
| } | } | ||
| Line 109: | Line 109: | ||
| @Override | @Override | ||
| protected Text getContainerName() { | protected Text getContainerName() { | ||
| + | // versions 1.18.2 and below | ||
| return new TranslatableText(" | return new TranslatableText(" | ||
| + | // versions since 1.19 | ||
| + | return Text.translatable(" | ||
| } | } | ||
| Line 274: | Line 277: | ||
| public void onInitializeClient() { | public void onInitializeClient() { | ||
| [...] | [...] | ||
| - | ScreenProviderRegistry.INSTANCE.< | + | ScreenProviderRegistry.INSTANCE.< |
| } | } | ||
| </ | </ | ||
| Line 305: | Line 308: | ||
| @Override | @Override | ||
| public void onInitializeClient() { | public void onInitializeClient() { | ||
| - | ScreenProviderRegistry.INSTANCE.< | + | ScreenProviderRegistry.INSTANCE.< |
| } | } | ||
| </ | </ | ||
tutorial/containers.1597388962.txt.gz · Last modified: 2020/08/14 07:09 by leocth2