From cce752b74fd37419ea2a7a818f33ddff101238e5 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Sun, 10 Jan 2021 18:51:24 +0800 Subject: [PATCH] Not automatically register the menu type, add methods to open the menu --- .../architectury/registry/MenuRegistry.java | 185 ++++++++++++++++++ .../registry/ScreenRegisters.java | 114 ----------- .../registry/menu/ExtendedMenuProvider.java | 27 +++ .../registry/fabric/MenuRegistryImpl.java | 75 +++++++ .../registry/fabric/ScreenRegistersImpl.java | 53 ----- .../main/resources/architectury.accessWidener | 4 +- ...gistersImpl.java => MenuRegistryImpl.java} | 50 +++-- 7 files changed, 312 insertions(+), 196 deletions(-) create mode 100644 common/src/main/java/me/shedaniel/architectury/registry/MenuRegistry.java delete mode 100644 common/src/main/java/me/shedaniel/architectury/registry/ScreenRegisters.java create mode 100644 common/src/main/java/me/shedaniel/architectury/registry/menu/ExtendedMenuProvider.java create mode 100644 fabric/src/main/java/me/shedaniel/architectury/registry/fabric/MenuRegistryImpl.java delete mode 100644 fabric/src/main/java/me/shedaniel/architectury/registry/fabric/ScreenRegistersImpl.java rename forge/src/main/java/me/shedaniel/architectury/registry/forge/{ScreenRegistersImpl.java => MenuRegistryImpl.java} (54%) diff --git a/common/src/main/java/me/shedaniel/architectury/registry/MenuRegistry.java b/common/src/main/java/me/shedaniel/architectury/registry/MenuRegistry.java new file mode 100644 index 00000000..f2f3eeb9 --- /dev/null +++ b/common/src/main/java/me/shedaniel/architectury/registry/MenuRegistry.java @@ -0,0 +1,185 @@ +/* + * This file is part of architectury. + * Copyright (C) 2020, 2021 shedaniel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package me.shedaniel.architectury.registry; + +import me.shedaniel.architectury.ExpectPlatform; +import me.shedaniel.architectury.registry.menu.ExtendedMenuProvider; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.inventory.MenuAccess; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.chat.Component; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuType; +import org.jetbrains.annotations.Nullable; + +import java.util.function.Consumer; + +/** + * A utility class to register {@link MenuType}s and {@link Screen}s for containers + */ +public final class MenuRegistry { + private MenuRegistry() {} + + /** + * Opens the menu. + * + * @param player The player affected + * @param provider The {@link MenuProvider} that provides the menu + * @param bufWriter That writer that sends extra data for {@link MenuType} created with {@link MenuRegistry#ofExtended(ExtendedMenuTypeFactory)} + */ + public static void openExtendedMenu(ServerPlayer player, MenuProvider provider, Consumer bufWriter) { + openExtendedMenu(player, new ExtendedMenuProvider() { + @Override + public void saveExtraData(FriendlyByteBuf buf) { + bufWriter.accept(buf); + } + + @Override + public Component getDisplayName() { + return provider.getDisplayName(); + } + + @Nullable + @Override + public AbstractContainerMenu createMenu(int i, Inventory inventory, Player player) { + return provider.createMenu(i, inventory, player); + } + }); + } + + /** + * Opens the menu. + * + * @param player The player affected + * @param provider The {@link ExtendedMenuProvider} that provides the menu + */ + @ExpectPlatform + public static void openExtendedMenu(ServerPlayer player, ExtendedMenuProvider provider) { + throw new AssertionError(); + } + + /** + * Opens the menu. + * + * @param player The player affected + * @param provider The {@link MenuProvider} that provides the menu + */ + public static void openMenu(ServerPlayer player, MenuProvider provider) { + player.openMenu(provider); + } + + /** + * Creates a simple {@link MenuType}. + * + * @param factory A functional interface to create the {@link MenuType} from an id (Integer) and inventory + * @param The type of {@link AbstractContainerMenu} that handles the logic for the {@link MenuType} + * @return The {@link MenuType} for your {@link AbstractContainerMenu} + */ + @ExpectPlatform + public static MenuType of(SimpleMenuTypeFactory factory) { + throw new AssertionError(); + } + + /** + * Creates a extended {@link MenuType}. + * + * @param factory A functional interface to create the {@link MenuType} from an id (Integer), {@link Inventory}, and {@link FriendlyByteBuf} + * @param The type of {@link AbstractContainerMenu} that handles the logic for the {@link MenuType} + * @return The {@link MenuType} for your {@link AbstractContainerMenu} + */ + @ExpectPlatform + public static MenuType ofExtended(ExtendedMenuTypeFactory factory) { + throw new AssertionError(); + } + + /** + * Registers a Screen Factory on the client to display. + * + * @param type The {@link MenuType} the screen visualizes + * @param factory A functional interface that is used to create new {@link Screen}s + * @param The type of {@link AbstractContainerMenu} for the screen + * @param The type for the {@link Screen} + */ + @Environment(EnvType.CLIENT) + @ExpectPlatform + public static > void registerScreenFactory(MenuType type, ScreenFactory factory) { + throw new AssertionError(); + } + + /** + * Creates new screens. + * + * @param The type of {@link AbstractContainerMenu} for the screen + * @param The type for the {@link Screen} + */ + @Environment(EnvType.CLIENT) + @FunctionalInterface + public interface ScreenFactory> { + /** + * Creates a new {@link S} that extends {@link Screen} + * + * @param containerMenu The {@link AbstractContainerMenu} that controls the game logic for the screen + * @param inventory The {@link Inventory} for the screen + * @param component The {@link Component} for the screen + * @return A new {@link S} that extends {@link Screen} + */ + S create(H containerMenu, Inventory inventory, Component component); + } + + /** + * Creates simple menus. + * + * @param The {@link AbstractContainerMenu} type + */ + @FunctionalInterface + public interface SimpleMenuTypeFactory { + /** + * Creates a new {@link T} that extends {@link AbstractContainerMenu} + * + * @param id The id for the menu + * @return A new {@link T} that extends {@link AbstractContainerMenu} + */ + T create(int id, Inventory inventory); + } + + /** + * Creates extended menus. + * + * @param The {@link AbstractContainerMenu} type + */ + @FunctionalInterface + public interface ExtendedMenuTypeFactory { + /** + * Creates a new {@link T} that extends {@link AbstractContainerMenu}. + * + * @param id The id for the menu + * @param inventory The {@link Inventory} for the menu + * @param buf The {@link FriendlyByteBuf} for the menu to provide extra data + * @return A new {@link T} that extends {@link AbstractContainerMenu} + */ + T create(int id, Inventory inventory, FriendlyByteBuf buf); + } +} diff --git a/common/src/main/java/me/shedaniel/architectury/registry/ScreenRegisters.java b/common/src/main/java/me/shedaniel/architectury/registry/ScreenRegisters.java deleted file mode 100644 index 85bde18d..00000000 --- a/common/src/main/java/me/shedaniel/architectury/registry/ScreenRegisters.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * This file is part of architectury. - * Copyright (C) 2020, 2021 shedaniel - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package me.shedaniel.architectury.registry; - -import java.util.function.BiFunction; - -import me.shedaniel.architectury.ExpectPlatform; - -import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.gui.screens.inventory.MenuAccess; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.player.Inventory; -import net.minecraft.world.inventory.AbstractContainerMenu; -import net.minecraft.world.inventory.MenuType; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; - -/** - * A utility class to register {@link MenuType}s and {@link Screen}s for containers - */ -public final class ScreenRegisters { - private ScreenRegisters() {} - - /** - * Registers a simple {@link MenuType} - * @param resourceLocation The identifier for the {@link MenuType} - * @param menuTypeSupplier A functional interface to create the {@link MenuType} from an id (Integer) and inventory - * @param The type of {@link AbstractContainerMenu} that handles the logic for the {@link MenuType} - * @return The {@link MenuType} for your {@link AbstractContainerMenu} - */ - @ExpectPlatform - public static MenuType registerSimpleMenuType(ResourceLocation resourceLocation, BiFunction menuTypeSupplier) { - throw new AssertionError(); - } - - /** - * Registers a extended {@link MenuType} - * @param resourceLocation The identifier for the {@link MenuType} - * @param menuTypeSupplier A functional interface to create the {@link MenuType} from an id (Integer), {@link Inventory}, and {@link FriendlyByteBuf} - * @param The type of {@link AbstractContainerMenu} that handles the logic for the {@link MenuType} - * @return The {@link MenuType} for your {@link AbstractContainerMenu} - */ - @ExpectPlatform - public static MenuType registerExtendedMenuType(ResourceLocation resourceLocation, ExtendedMenuTypeFactory menuTypeSupplier) { - throw new AssertionError(); - } - - /** - * Registers a Screen Factory on the client to display - * @param menuType The {@link MenuType} the screen visualizes - * @param screenSupplier A functional interface that is used to create new {@link Screen}s - * @param The type of {@link AbstractContainerMenu} for the screen - * @param The type for the {@link Screen} - */ - @Environment(EnvType.CLIENT) - @ExpectPlatform - public static > void registerScreenFactory(MenuType menuType, ScreenFactory screenSupplier) { - throw new AssertionError(); - } - - /** - * Creates new screens - * @param The type of {@link AbstractContainerMenu} for the screen - * @param The type for the {@link Screen} - */ - @Environment(EnvType.CLIENT) - @FunctionalInterface - public interface ScreenFactory> { - /** - * Creates a new {@link S} that extends {@link Screen} - * @param containerMenu The {@link AbstractContainerMenu} that controls the game logic for the screen - * @param inventory The {@link Inventory} for the screen - * @param component The {@link Component} for the screen - * @return A new {@link S} that extends {@link Screen} - */ - S create(H containerMenu, Inventory inventory, Component component); - } - - /** - * Creates extended menus - * @param The {@link AbstractContainerMenu} type - */ - @FunctionalInterface - public interface ExtendedMenuTypeFactory { - /** - * Creates a new {@link T} that extends {@link AbstractContainerMenu} - * @param id The id for the menu - * @param inventory The {@link Inventory} for the menu - * @param friendlyByteBuf The {@link FriendlyByteBuf} for the menu to provide extra data - * @return A new {@link T} that extends {@link AbstractContainerMenu} - */ - T create(int id, Inventory inventory, FriendlyByteBuf friendlyByteBuf); - } -} diff --git a/common/src/main/java/me/shedaniel/architectury/registry/menu/ExtendedMenuProvider.java b/common/src/main/java/me/shedaniel/architectury/registry/menu/ExtendedMenuProvider.java new file mode 100644 index 00000000..70ef6641 --- /dev/null +++ b/common/src/main/java/me/shedaniel/architectury/registry/menu/ExtendedMenuProvider.java @@ -0,0 +1,27 @@ +/* + * This file is part of architectury. + * Copyright (C) 2020, 2021 shedaniel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package me.shedaniel.architectury.registry.menu; + +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.MenuProvider; + +public interface ExtendedMenuProvider extends MenuProvider { + void saveExtraData(FriendlyByteBuf buf); +} diff --git a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/MenuRegistryImpl.java b/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/MenuRegistryImpl.java new file mode 100644 index 00000000..066954a2 --- /dev/null +++ b/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/MenuRegistryImpl.java @@ -0,0 +1,75 @@ +/* + * This file is part of architectury. + * Copyright (C) 2020, 2021 shedaniel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package me.shedaniel.architectury.registry.fabric; + +import me.shedaniel.architectury.registry.MenuRegistry.ExtendedMenuTypeFactory; +import me.shedaniel.architectury.registry.MenuRegistry.ScreenFactory; +import me.shedaniel.architectury.registry.MenuRegistry.SimpleMenuTypeFactory; +import me.shedaniel.architectury.registry.menu.ExtendedMenuProvider; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry; +import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory; +import net.fabricmc.fabric.impl.screenhandler.ExtendedScreenHandlerType; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.inventory.MenuAccess; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.chat.Component; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuType; +import org.jetbrains.annotations.Nullable; + +public class MenuRegistryImpl { + public static void openMenu(ServerPlayer player, ExtendedMenuProvider provider) { + player.openMenu(new ExtendedScreenHandlerFactory() { + @Override + public void writeScreenOpeningData(ServerPlayer player, FriendlyByteBuf buf) { + provider.saveExtraData(buf); + } + + @Override + public Component getDisplayName() { + return provider.getDisplayName(); + } + + @Nullable + @Override + public AbstractContainerMenu createMenu(int i, Inventory inventory, Player player) { + return provider.createMenu(i, inventory, player); + } + }); + } + + public static MenuType of(SimpleMenuTypeFactory factory) { + return new MenuType<>(factory::create); + } + + public static MenuType ofExtended(ExtendedMenuTypeFactory factory) { + return new ExtendedScreenHandlerType<>(factory::create); + } + + @Environment(EnvType.CLIENT) + public static > void registerScreenFactory(MenuType type, ScreenFactory factory) { + ScreenRegistry.register(type, factory::create); + } +} diff --git a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/ScreenRegistersImpl.java b/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/ScreenRegistersImpl.java deleted file mode 100644 index 3d98958b..00000000 --- a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/ScreenRegistersImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This file is part of architectury. - * Copyright (C) 2020, 2021 shedaniel - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package me.shedaniel.architectury.registry.fabric; - -import java.util.function.BiFunction; - -import me.shedaniel.architectury.ExpectPlatform; -import me.shedaniel.architectury.registry.ScreenRegisters; - -import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.gui.screens.inventory.MenuAccess; -import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.player.Inventory; -import net.minecraft.world.inventory.AbstractContainerMenu; -import net.minecraft.world.inventory.MenuType; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry; -import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry; - -public class ScreenRegistersImpl { - public static MenuType registerMenuType(ResourceLocation resourceLocation, BiFunction menuTypeSupplier) { - return ScreenHandlerRegistry.registerSimple(resourceLocation, menuTypeSupplier::apply); - } - - public static MenuType registerExtendedMenuType(ResourceLocation resourceLocation, ScreenRegisters.ExtendedMenuTypeFactory menuTypeSupplier) { - return ScreenHandlerRegistry.registerExtended(resourceLocation, menuTypeSupplier::create); - } - - @Environment(EnvType.CLIENT) - public static > void registerScreenFactory(MenuType menuType, ScreenRegisters.ScreenFactory screenSupplier) { - ScreenRegistry.register(menuType, screenSupplier::create); - } -} diff --git a/fabric/src/main/resources/architectury.accessWidener b/fabric/src/main/resources/architectury.accessWidener index c0361a72..b21dac89 100644 --- a/fabric/src/main/resources/architectury.accessWidener +++ b/fabric/src/main/resources/architectury.accessWidener @@ -52,4 +52,6 @@ accessible field net/minecraft/server/packs/repository/PackRepository sources Lj mutable field net/minecraft/server/packs/repository/PackRepository sources Ljava/util/Set; accessible field net/minecraft/world/item/DyeColor textureDiffuseColor I accessible method net/minecraft/world/entity/player/Player closeContainer ()V -accessible method net/minecraft/advancements/CriteriaTriggers register (Lnet/minecraft/advancements/CriterionTrigger;)Lnet/minecraft/advancements/CriterionTrigger; \ No newline at end of file +accessible method net/minecraft/advancements/CriteriaTriggers register (Lnet/minecraft/advancements/CriterionTrigger;)Lnet/minecraft/advancements/CriterionTrigger; +accessible method net/minecraft/world/inventory/MenuType (Lnet/minecraft/world/inventory/MenuType$MenuSupplier;)V +accessible class net/minecraft/world/inventory/MenuType$MenuSupplier \ No newline at end of file diff --git a/forge/src/main/java/me/shedaniel/architectury/registry/forge/ScreenRegistersImpl.java b/forge/src/main/java/me/shedaniel/architectury/registry/forge/MenuRegistryImpl.java similarity index 54% rename from forge/src/main/java/me/shedaniel/architectury/registry/forge/ScreenRegistersImpl.java rename to forge/src/main/java/me/shedaniel/architectury/registry/forge/MenuRegistryImpl.java index 1b3e85a5..019cd51d 100644 --- a/forge/src/main/java/me/shedaniel/architectury/registry/forge/ScreenRegistersImpl.java +++ b/forge/src/main/java/me/shedaniel/architectury/registry/forge/MenuRegistryImpl.java @@ -19,42 +19,36 @@ package me.shedaniel.architectury.registry.forge; -import java.util.function.BiFunction; - -import me.shedaniel.architectury.forge.ArchitecturyForge; -import me.shedaniel.architectury.registry.DeferredRegister; -import me.shedaniel.architectury.registry.ScreenRegisters; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.extensions.IForgeContainerType; - +import me.shedaniel.architectury.registry.MenuRegistry.ExtendedMenuTypeFactory; +import me.shedaniel.architectury.registry.MenuRegistry.ScreenFactory; +import me.shedaniel.architectury.registry.MenuRegistry.SimpleMenuTypeFactory; +import me.shedaniel.architectury.registry.menu.ExtendedMenuProvider; import net.minecraft.client.gui.screens.MenuScreens; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.MenuAccess; -import net.minecraft.core.Registry; -import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.player.Inventory; +import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.MenuType; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.common.extensions.IForgeContainerType; +import net.minecraftforge.fml.network.NetworkHooks; -public class ScreenRegistersImpl { - private static final DeferredRegister> MENU_TYPE_REGISTRY = DeferredRegister.create(ArchitecturyForge.MOD_ID, Registry.MENU_REGISTRY); - - public static MenuType registerMenuType(ResourceLocation resourceLocation, BiFunction menuTypeSupplier) { - MenuType menuType = IForgeContainerType.create((windowId, inv, data) -> menuTypeSupplier.apply(windowId, inv)); - MENU_TYPE_REGISTRY.register(resourceLocation, () -> menuType); - return menuType; +public class MenuRegistryImpl { + public static void openMenu(ServerPlayer player, ExtendedMenuProvider provider) { + NetworkHooks.openGui(player, provider, provider::saveExtraData); } - - public static MenuType registerExtendedMenuType(ResourceLocation resourceLocation, ScreenRegisters.ExtendedMenuTypeFactory menuTypeSupplier) { - MenuType menuType = IForgeContainerType.create(menuTypeSupplier::create); - MENU_TYPE_REGISTRY.register(resourceLocation, () -> menuType); - return menuType; + + public static MenuType registerMenuType(SimpleMenuTypeFactory factory) { + return new MenuType<>(factory::create); } - + + public static MenuType registerExtendedMenuType(ExtendedMenuTypeFactory factory) { + return IForgeContainerType.create(factory::create); + } + @OnlyIn(Dist.CLIENT) - public static > void registerScreenFactory(MenuType menuType, ScreenRegisters.ScreenFactory screenSupplier) { - MenuScreens.register(menuType, screenSupplier::create); + public static > void registerScreenFactory(MenuType type, ScreenFactory factory) { + MenuScreens.register(type, factory::create); } }