tutorial:extendedscreenhandler
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:extendedscreenhandler [2020/08/14 16:24] – [Using the Information of the ExtendedScreenHandler in our Screen] manymoney2 | tutorial:extendedscreenhandler [2020/08/14 16:38] – [Registering our ScreenHandler] manymoney2 | ||
---|---|---|---|
Line 145: | Line 145: | ||
</ | </ | ||
+ | |||
+ | ====== Registering our ScreenHandler ====== | ||
+ | |||
+ | <code java [enable_line_numbers=" | ||
+ | public class ExampleMod implements ModInitializer { | ||
+ | |||
+ | [...] | ||
+ | public static final ScreenHandlerType< | ||
+ | |||
+ | static { | ||
+ | [...] | ||
+ | |||
+ | //we now use registerExtended as our screenHandler now accepts a packetByteBuf in its Constructor | ||
+ | BOX_SCREEN_HANDLER = ScreenHandlerRegistry.registerExtended(BOX, | ||
+ | } | ||
+ | |||
+ | @Override | ||
+ | public void onInitialize() { | ||
+ | |||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ====== Result ====== | ||
+ | You have now seen how to transfer data when the ScreenHandler is opened. In the image you can see the result: The Blocks title is now the block position. Do note that this is just a demonstration, | ||
+ | Setting the position as the title would be possible alot easier. | ||
+ | |||
+ | {{: | ||
+ | |||
+ |
tutorial/extendedscreenhandler.txt · Last modified: 2022/12/17 15:38 by miir