Class ScreenRegistry

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

@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:
  • Method Details

    • register

      public static <H extends ScreenHandler, S extends Screen & ScreenHandlerProvider<H>> void register(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