#How to create simple gui

1 messages · Page 1 of 1 (latest)

glass sentinel
#

I'm trieng creating a simple gui, to know how to setup a gui.

Idk to what set the codec

TEST = Registry.register(Registries.SCREEN_HANDLER, new Identifier(Silvercraft.MOD_ID, "test"),
                new ExtendedScreenHandlerType<>(TestScreenHandler::new, null));
#

all examples i found there hasn't a second argument, but here its requierd a codec

steady notch
#

create class which extends Screen

#

add widgets, for example:

public ButtonWidget button2;
button2 = ButtonWidget.builder(/*name*/), button -> {
                 //button logic
                })
                .dimensions(width / 2, 100, 70, 20)
                .tooltip(/*tooltip*/)
                .build();
addDrawableChild(button2);
#

opening menu:

ClientTickEvents.END_CLIENT_TICK.register(client -> {
            if(client!=null) {
                while (keyBinding.wasPressed()) {
                    ConfigMenuScreen configMenuScreen = new ConfigMenuScreen();
                    client.setScreen(configMenuScreen);
                }
            }
        });
glass sentinel
#

on the client sided?

#

i already created a Screen handler which i couldn't register

#

i wanted create a gui for a block entity

glass sentinel
steady notch
glass sentinel
glass sentinel
#

i could fix that now i have a other error

steady notch
# glass sentinel

the error says that somewhere there is a link to a non-existent collection index, I think this doesn’t tell you anything