Class ScreenRegistry

java.lang.Object
net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry

@Environment(CLIENT) @Deprecated public final class ScreenRegistry extends Object
Deprecated.
Replaced by access wideners for HandledScreens.register(ScreenHandlerType, HandledScreens.Provider) and
invalid @link
HandledScreens.Provider
in Fabric Transitive Access Wideners (v1).
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

    Nested Classes
    Modifier and Type
    Class
    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>>
    Deprecated.
    A factory for handled screens.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 type
      S - the screen type
      Parameters:
      type - the screen handler type object
      screenFactory - the screen handler factory