aboutsummaryrefslogtreecommitdiff
path: root/GuiTest/src
diff options
context:
space:
mode:
authorGreg C <Gregory1234@users.noreply.github.com>2022-03-20 17:33:27 +0100
committerGitHub <noreply@github.com>2022-03-20 18:33:27 +0200
commit92a6dd2bf4fa3627bbcc4473ceb5a0d3f9b11bfe (patch)
treebba3ff609d0627b12e12b8888a5df15b1116264e /GuiTest/src
parent88ba5ed7ce3603c6c6decf95f1fa46108cd9f0b3 (diff)
downloadLibGui-92a6dd2bf4fa3627bbcc4473ceb5a0d3f9b11bfe.tar.gz
LibGui-92a6dd2bf4fa3627bbcc4473ceb5a0d3f9b11bfe.tar.bz2
LibGui-92a6dd2bf4fa3627bbcc4473ceb5a0d3f9b11bfe.zip
Updated to 1.18.2 (#155)
Diffstat (limited to 'GuiTest/src')
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java7
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java6
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
);