Class ScreenRegistry
java.lang.Object
net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry
Deprecated.
An API for registering handled screens that represent screen handlers on the client.
Exposes vanilla's private
HandledScreens.register()
to modders as ScreenRegistry.register()
.
Example
// 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);
}
}
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic 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>> Deprecated.A factory for handled screens. -
Method Summary
Modifier and TypeMethodDescriptionstatic <H extends net.minecraft.screen.ScreenHandler,
S extends net.minecraft.client.gui.screen.Screen & net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider<H>>
voidregister
(net.minecraft.screen.ScreenHandlerType<? extends H> type, ScreenRegistry.Factory<H, S> screenFactory) Deprecated.Registers a new screen factory for a screen handler type.
-
Method Details
-
register
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) Deprecated.Registers a new screen factory for a screen handler type.- Type Parameters:
H
- the screen handler typeS
- the screen type- Parameters:
type
- the screen handler type objectscreenFactory
- the screen handler factory
-
HandledScreens.register(ScreenHandlerType, HandledScreens.Provider)
andHandledScreens.Provider
in Fabric Transitive Access Wideners (v1).