diff options
Diffstat (limited to 'GuiTest/src/main/java')
-rw-r--r-- | GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java | 7 | ||||
-rw-r--r-- | GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java | 6 |
2 files changed, 7 insertions, 6 deletions
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java b/GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java index f938749..8a3fe4b 100644 --- a/GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java +++ b/GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java @@ -2,7 +2,6 @@ package io.github.cottonmc.test; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; -import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry; import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.ModContainer; import net.minecraft.block.AbstractBlock; @@ -47,11 +46,13 @@ public class LibGuiTest implements ModInitializer { GUI_BLOCKENTITY_TYPE = FabricBlockEntityTypeBuilder.create(GuiBlockEntity::new, GUI_BLOCK).build(null); Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(MODID, "gui"), GUI_BLOCKENTITY_TYPE); - GUI_SCREEN_HANDLER_TYPE = ScreenHandlerRegistry.registerSimple(new Identifier(MODID, "gui"), (int syncId, PlayerInventory inventory) -> { + GUI_SCREEN_HANDLER_TYPE = new ScreenHandlerType<>((int syncId, PlayerInventory inventory) -> { return new TestDescription(GUI_SCREEN_HANDLER_TYPE, syncId, inventory, ScreenHandlerContext.EMPTY); }); + Registry.register(Registry.SCREEN_HANDLER, new Identifier(MODID, "gui"), GUI_SCREEN_HANDLER_TYPE); - REALLY_SIMPLE_SCREEN_HANDLER_TYPE = ScreenHandlerRegistry.registerSimple(new Identifier(MODID, "really_simple"), ReallySimpleDescription::new); + REALLY_SIMPLE_SCREEN_HANDLER_TYPE = new ScreenHandlerType<>(ReallySimpleDescription::new); + Registry.register(Registry.SCREEN_HANDLER, new Identifier(MODID, "really_simple"), REALLY_SIMPLE_SCREEN_HANDLER_TYPE); Optional<ModContainer> containerOpt = FabricLoader.getInstance().getModContainer("jankson"); if (containerOpt.isPresent()) { diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java b/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java index 38545fa..fd031f5 100644 --- a/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java +++ b/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java @@ -4,8 +4,8 @@ import com.mojang.brigadier.Command; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.client.command.v1.ClientCommandManager; import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource; -import net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.ingame.HandledScreens; import net.minecraft.text.LiteralText; import io.github.cottonmc.cotton.gui.client.CottonClientScreen; @@ -26,12 +26,12 @@ public class LibGuiTestClient implements ClientModInitializer { @Override public void onInitializeClient() { - ScreenRegistry.<TestDescription, CottonInventoryScreen<TestDescription>>register( + HandledScreens.<TestDescription, CottonInventoryScreen<TestDescription>>register( LibGuiTest.GUI_SCREEN_HANDLER_TYPE, CottonInventoryScreen::new ); - ScreenRegistry.<ReallySimpleDescription, CottonInventoryScreen<ReallySimpleDescription>>register( + HandledScreens.<ReallySimpleDescription, CottonInventoryScreen<ReallySimpleDescription>>register( LibGuiTest.REALLY_SIMPLE_SCREEN_HANDLER_TYPE, CottonInventoryScreen::new ); |