Package net.fabricmc.fabric.api.screenhandler.v1
package net.fabricmc.fabric.api.screenhandler.v1
The Fabric screen handler API for creating screen handlers and screen handler types.
Screen handlers types are used to synchronize screen handlers between the server and the client. Their main job is to create screen handler instances on the client. Screen handlers manage the items and integer properties that are needed to show on screens, such as the items in a chest or the progress of a furnace.
Simple and extended screen handlers
"Simple" screen handlers are the type of screen handlers used in vanilla. They can automatically synchronize items and integer properties between the server and the client, but they don't support having custom data sent in the opening packet. You can create simple screen handlers using vanilla'sScreenHandlerType
.
This module adds extended screen handlers that can synchronize their own custom data
when they are opened, which can be useful for defining additional properties of a screen on the server.
For example, a mod can synchronize text that will show up as a label.
You can create extended screen handlers using
ExtendedScreenHandlerType
.
Opening screen handlers
Screen handlers can be opened usingPlayerEntity.openHandledScreen(net.minecraft.screen.NamedScreenHandlerFactory)
.
Note that calling it on the logical client does nothing. To open an extended screen handler, the factory passed in
should be an ExtendedScreenHandlerFactory
.-
ClassDescriptionAn extension of
NamedScreenHandlerFactory
that can write additional data to a screen opening packet.ExtendedScreenHandlerType<T extends net.minecraft.screen.ScreenHandler>AScreenHandlerType
for an extended screen handler that synchronizes additional data to the client when it is opened.ExtendedScreenHandlerType.ExtendedFactory<T extends net.minecraft.screen.ScreenHandler>A factory for creating screen handler instances from additional opening data.Deprecated.ScreenHandlerRegistry.ExtendedClientHandlerFactory<T extends net.minecraft.screen.ScreenHandler>Deprecated.Replaced withExtendedScreenHandlerType.ExtendedFactory
.ScreenHandlerRegistry.SimpleClientHandlerFactory<T extends net.minecraft.screen.ScreenHandler>Deprecated.Replaced by access widener forScreenHandlerType.Factory
in Fabric Transitive Access Wideners (v1).
ScreenHandlerType
using an access widener in Fabric Transitive Access Wideners (v1) Creating extended screen handler types withExtendedScreenHandlerType
Registering usingRegistry.SCREEN_HANDLER
directly