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 1a5dc7ef..a2ed82cd 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 @@ -20,8 +20,9 @@ public class ForgeBalmMenus implements BalmMenus { @Override public DeferredObject> registerMenu(ResourceLocation identifier, BalmMenuFactory factory) { DeferredRegister> register = DeferredRegisters.get(ForgeRegistries.MENU_TYPES, identifier.getNamespace()); + // TODO we have to create a RegistryFriendlyByteBuf ourselves because Forge is out of date RegistryObject> registryObject = register.register(identifier.getPath(), - () -> new MenuType<>((IContainerFactory) (syncId, inventory, buf) -> factory.create(syncId, inventory, factory.getStreamCodec().decode((RegistryFriendlyByteBuf) buf)), + () -> new MenuType<>((IContainerFactory) (syncId, inventory, buf) -> factory.create(syncId, inventory, factory.getStreamCodec().decode(new RegistryFriendlyByteBuf(buf, inventory.player.registryAccess()))), 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 b137b245..d96a5a7d 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,8 @@ public void openGui(Player player, MenuProvider menuProvider) { } private void openGui(ServerPlayer player, BalmMenuProvider menuProvider) { - player.openMenu(menuProvider, buf -> menuProvider.getScreenStreamCodec().encode((RegistryFriendlyByteBuf) buf, menuProvider.getScreenOpeningData(player))); + // TODO we have to create a RegistryFriendlyByteBuf ourselves because Forge is out of date + player.openMenu(menuProvider, buf -> menuProvider.getScreenStreamCodec().encode(new RegistryFriendlyByteBuf(buf, player.registryAccess()), menuProvider.getScreenOpeningData(player))); } @Override