Class MenuRegistry
java.lang.Object
me.shedaniel.architectury.registry.MenuRegistry
A utility class to register 
MenuTypes and Screens for containers- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceMenuRegistry.ExtendedMenuTypeFactory<T extends net.minecraft.world.inventory.AbstractContainerMenu>Creates extended menus.static interfaceMenuRegistry.ScreenFactory<H extends net.minecraft.world.inventory.AbstractContainerMenu,S extends net.minecraft.client.gui.screens.Screen & net.minecraft.client.gui.screens.inventory.MenuAccess<H>> Creates new screens.static interfaceMenuRegistry.SimpleMenuTypeFactory<T extends net.minecraft.world.inventory.AbstractContainerMenu>Creates simple menus. - 
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends net.minecraft.world.inventory.AbstractContainerMenu>
net.minecraft.world.inventory.MenuType<T>of(MenuRegistry.SimpleMenuTypeFactory<T> factory) Creates a simpleMenuType.static <T extends net.minecraft.world.inventory.AbstractContainerMenu>
net.minecraft.world.inventory.MenuType<T>ofExtended(MenuRegistry.ExtendedMenuTypeFactory<T> factory) Creates a extendedMenuType.static voidopenExtendedMenu(net.minecraft.server.level.ServerPlayer player, ExtendedMenuProvider provider) Opens the menu.static voidopenExtendedMenu(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.MenuProvider provider, Consumer<net.minecraft.network.FriendlyByteBuf> bufWriter) Opens the menu.static voidopenMenu(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.MenuProvider provider) Opens the menu.static <H extends net.minecraft.world.inventory.AbstractContainerMenu,S extends net.minecraft.client.gui.screens.Screen & net.minecraft.client.gui.screens.inventory.MenuAccess<H>> 
voidregisterScreenFactory(net.minecraft.world.inventory.MenuType<? extends H> type, MenuRegistry.ScreenFactory<H, S> factory) Registers a Screen Factory on the client to display. 
- 
Method Details
- 
openExtendedMenu
public static void openExtendedMenu(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.MenuProvider provider, Consumer<net.minecraft.network.FriendlyByteBuf> bufWriter) Opens the menu.- Parameters:
 player- The player affectedprovider- TheMenuProviderthat provides the menubufWriter- That writer that sends extra data forMenuTypecreated withofExtended(ExtendedMenuTypeFactory)
 - 
openMenu
public static void openMenu(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.MenuProvider provider) Opens the menu.- Parameters:
 player- The player affectedprovider- TheMenuProviderthat provides the menu
 - 
of
public static <T extends net.minecraft.world.inventory.AbstractContainerMenu> net.minecraft.world.inventory.MenuType<T> of(MenuRegistry.SimpleMenuTypeFactory<T> factory) Creates a simpleMenuType.- Type Parameters:
 T- The type ofAbstractContainerMenuthat handles the logic for theMenuType- Parameters:
 factory- A functional interface to create theMenuTypefrom an id (Integer) and inventory- Returns:
 - The 
MenuTypefor yourAbstractContainerMenu 
 - 
ofExtended
public static <T extends net.minecraft.world.inventory.AbstractContainerMenu> net.minecraft.world.inventory.MenuType<T> ofExtended(MenuRegistry.ExtendedMenuTypeFactory<T> factory) Creates a extendedMenuType.- Type Parameters:
 T- The type ofAbstractContainerMenuthat handles the logic for theMenuType- Parameters:
 factory- A functional interface to create theMenuTypefrom an id (Integer),Inventory, andFriendlyByteBuf- Returns:
 - The 
MenuTypefor yourAbstractContainerMenu 
 - 
registerScreenFactory
@Environment(CLIENT) public static <H extends net.minecraft.world.inventory.AbstractContainerMenu,S extends net.minecraft.client.gui.screens.Screen & net.minecraft.client.gui.screens.inventory.MenuAccess<H>> void registerScreenFactory(net.minecraft.world.inventory.MenuType<? extends H> type, MenuRegistry.ScreenFactory<H, S> factory) Registers a Screen Factory on the client to display.- Type Parameters:
 H- The type ofAbstractContainerMenufor the screenS- The type for theScreen- Parameters:
 type- TheMenuTypethe screen visualizesfactory- A functional interface that is used to create newScreens
 
 -