From 4ce3823fd59bd9c38d8f2a993785a6a475a66881 Mon Sep 17 00:00:00 2001 From: BlayTheNinth <1933180+BlayTheNinth@users.noreply.github.com> Date: Tue, 21 May 2024 13:47:03 +0200 Subject: [PATCH] fix: Fix compile errors --- .../java/net/blay09/mods/balm/fabric/menu/FabricBalmMenus.java | 2 +- .../java/net/blay09/mods/balm/forge/menu/ForgeBalmMenus.java | 3 ++- .../blay09/mods/balm/forge/network/ForgeBalmNetworking.java | 2 +- .../net/blay09/mods/balm/neoforge/menu/NeoForgeBalmMenus.java | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fabric/src/main/java/net/blay09/mods/balm/fabric/menu/FabricBalmMenus.java b/fabric/src/main/java/net/blay09/mods/balm/fabric/menu/FabricBalmMenus.java index f609ac56..5e96f99e 100644 --- a/fabric/src/main/java/net/blay09/mods/balm/fabric/menu/FabricBalmMenus.java +++ b/fabric/src/main/java/net/blay09/mods/balm/fabric/menu/FabricBalmMenus.java @@ -17,7 +17,7 @@ public DeferredObject(identifier, () -> Registry.register(BuiltInRegistries.MENU, identifier, - (MenuType) new ExtendedScreenHandlerType<>(factory::create, factory.getCodec()))).resolveImmediately(); + (MenuType) new ExtendedScreenHandlerType<>(factory::create, factory.getStreamCodec()))).resolveImmediately(); } } diff --git a/forge/src/main/java/net/blay09/mods/balm/forge/menu/ForgeBalmMenus.java b/forge/src/main/java/net/blay09/mods/balm/forge/menu/ForgeBalmMenus.java index 49cd8d85..1a5dc7ef 100644 --- a/forge/src/main/java/net/blay09/mods/balm/forge/menu/ForgeBalmMenus.java +++ b/forge/src/main/java/net/blay09/mods/balm/forge/menu/ForgeBalmMenus.java @@ -4,6 +4,7 @@ import net.blay09.mods.balm.api.menu.BalmMenuFactory; import net.blay09.mods.balm.api.menu.BalmMenus; import net.blay09.mods.balm.forge.DeferredRegisters; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.flag.FeatureFlagSet; import net.minecraft.world.flag.FeatureFlags; @@ -20,7 +21,7 @@ public class ForgeBalmMenus implements BalmMenus { public DeferredObject> registerMenu(ResourceLocation identifier, BalmMenuFactory factory) { DeferredRegister> register = DeferredRegisters.get(ForgeRegistries.MENU_TYPES, identifier.getNamespace()); RegistryObject> registryObject = register.register(identifier.getPath(), - () -> new MenuType<>((IContainerFactory) (syncId, inventory, buf) -> factory.create(syncId, inventory, factory.getCodec().decode(buf)), + () -> new MenuType<>((IContainerFactory) (syncId, inventory, buf) -> factory.create(syncId, inventory, factory.getStreamCodec().decode((RegistryFriendlyByteBuf) buf)), FeatureFlagSet.of(FeatureFlags.VANILLA))); return new DeferredObject<>(identifier, registryObject, registryObject::isPresent); } diff --git a/forge/src/main/java/net/blay09/mods/balm/forge/network/ForgeBalmNetworking.java b/forge/src/main/java/net/blay09/mods/balm/forge/network/ForgeBalmNetworking.java index bd3cc95f..b137b245 100644 --- a/forge/src/main/java/net/blay09/mods/balm/forge/network/ForgeBalmNetworking.java +++ b/forge/src/main/java/net/blay09/mods/balm/forge/network/ForgeBalmNetworking.java @@ -59,7 +59,7 @@ public void openGui(Player player, MenuProvider menuProvider) { } private void openGui(ServerPlayer player, BalmMenuProvider menuProvider) { - player.openMenu(menuProvider, buf -> menuProvider.getScreenStreamCodec().encode(buf, menuProvider.getScreenOpeningData(player))); + player.openMenu(menuProvider, buf -> menuProvider.getScreenStreamCodec().encode((RegistryFriendlyByteBuf) buf, menuProvider.getScreenOpeningData(player))); } @Override diff --git a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/menu/NeoForgeBalmMenus.java b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/menu/NeoForgeBalmMenus.java index fc715470..5109a62b 100644 --- a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/menu/NeoForgeBalmMenus.java +++ b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/menu/NeoForgeBalmMenus.java @@ -18,7 +18,7 @@ public class NeoForgeBalmMenus implements BalmMenus { public DeferredObject> registerMenu(ResourceLocation identifier, BalmMenuFactory factory) { final var register = DeferredRegisters.get(Registries.MENU, identifier.getNamespace()); final var registryObject = register.register(identifier.getPath(), - () -> new MenuType<>((IContainerFactory) (syncId, inventory, buf) -> factory.create(syncId, inventory, factory.getCodec().decode(buf)), + () -> new MenuType<>((IContainerFactory) (syncId, inventory, buf) -> factory.create(syncId, inventory, factory.getStreamCodec().decode(buf)), FeatureFlagSet.of(FeatureFlags.VANILLA))); return new DeferredObject<>(identifier, registryObject, registryObject::isBound); }