@Environment(value=CLIENT) public final class ScreenRegistry extends Object
HandledScreens.register()
to modders as ScreenRegistry.register()
.
// In a client-side initialization method:
ScreenRegistry.register(MyScreenHandlers.OVEN, OvenScreen::new);
// Screen class
public class OvenScreen extends HandledScreen<OvenScreenHandler> {
public OvenScreen(OvenScreenHandler handler, PlayerInventory inventory, Text title) {
super(handler, inventory, title);
}
}
registering screen handlers
Modifier and Type | Class and Description |
---|---|
static interface |
ScreenRegistry.Factory<H extends net.minecraft.screen.ScreenHandler,S extends net.minecraft.client.gui.screen.Screen & net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider<H>>
A factory for handled screens.
|
Modifier and Type | Method and Description |
---|---|
static <H extends net.minecraft.screen.ScreenHandler,S extends net.minecraft.client.gui.screen.Screen & net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider<H>> |
register(net.minecraft.screen.ScreenHandlerType<? extends H> type,
ScreenRegistry.Factory<H,S> screenFactory)
Registers a new screen factory for a screen handler type.
|
public static <H extends net.minecraft.screen.ScreenHandler,S extends net.minecraft.client.gui.screen.Screen & net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider<H>> void register(net.minecraft.screen.ScreenHandlerType<? extends H> type, ScreenRegistry.Factory<H,S> screenFactory)
H
- the screen handler typeS
- the screen typetype
- the screen handler type objectscreenFactory
- the screen handler factory