Skip to content

Commit

Permalink
fix: Fix compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed May 21, 2024
1 parent 7218fa0 commit 4ce3823
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public <TMenu extends AbstractContainerMenu, TPayload> DeferredObject<MenuType<T
return new DeferredObject<>(identifier,
() -> Registry.register(BuiltInRegistries.MENU,
identifier,
(MenuType<TMenu>) new ExtendedScreenHandlerType<>(factory::create, factory.getCodec()))).resolveImmediately();
(MenuType<TMenu>) new ExtendedScreenHandlerType<>(factory::create, factory.getStreamCodec()))).resolveImmediately();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -20,7 +21,7 @@ public class ForgeBalmMenus implements BalmMenus {
public <TMenu extends AbstractContainerMenu, TPayload> DeferredObject<MenuType<TMenu>> registerMenu(ResourceLocation identifier, BalmMenuFactory<TMenu, TPayload> factory) {
DeferredRegister<MenuType<?>> register = DeferredRegisters.get(ForgeRegistries.MENU_TYPES, identifier.getNamespace());
RegistryObject<MenuType<TMenu>> registryObject = register.register(identifier.getPath(),
() -> new MenuType<>((IContainerFactory<TMenu>) (syncId, inventory, buf) -> factory.create(syncId, inventory, factory.getCodec().decode(buf)),
() -> new MenuType<>((IContainerFactory<TMenu>) (syncId, inventory, buf) -> factory.create(syncId, inventory, factory.getStreamCodec().decode((RegistryFriendlyByteBuf) buf)),
FeatureFlagSet.of(FeatureFlags.VANILLA)));
return new DeferredObject<>(identifier, registryObject, registryObject::isPresent);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void openGui(Player player, MenuProvider menuProvider) {
}

private <T> void openGui(ServerPlayer player, BalmMenuProvider<T> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class NeoForgeBalmMenus implements BalmMenus {
public <TMenu extends AbstractContainerMenu, TPayload> DeferredObject<MenuType<TMenu>> registerMenu(ResourceLocation identifier, BalmMenuFactory<TMenu, TPayload> factory) {
final var register = DeferredRegisters.get(Registries.MENU, identifier.getNamespace());
final var registryObject = register.register(identifier.getPath(),
() -> new MenuType<>((IContainerFactory<TMenu>) (syncId, inventory, buf) -> factory.create(syncId, inventory, factory.getCodec().decode(buf)),
() -> new MenuType<>((IContainerFactory<TMenu>) (syncId, inventory, buf) -> factory.create(syncId, inventory, factory.getStreamCodec().decode(buf)),
FeatureFlagSet.of(FeatureFlags.VANILLA)));
return new DeferredObject<>(identifier, registryObject, registryObject::isBound);
}
Expand Down

0 comments on commit 4ce3823

Please sign in to comment.