Jump to content

[1.20.2 - Solved] FriendlyByteBuff is null in constructor when using IForgeMenu.create for registration of custom menu type


Florion111

Recommended Posts

You just saved my life, Thanks!!!

 

For those still wondering, I'm leaving my fixed "use" method right here :

	@Override
    public InteractionResult use(BlockState pState, Level pLevel, BlockPos pPos, Player pPlayer, InteractionHand pHand, BlockHitResult pHit) {

        if (!pLevel.isClientSide()) {
            BlockEntity entity = pLevel.getBlockEntity(pPos);
            if(entity instanceof LightForgeBlockEntity) {

                IForgeServerPlayer thePlayer = (IForgeServerPlayer) pPlayer;
                thePlayer.openMenu((LightForgeBlockEntity) entity, pPos);

            } else {
                throw new IllegalStateException("Our Container provider is missing!");
            }
        }

        return InteractionResult.sidedSuccess(pLevel.isClientSide());
    }

I'll get the register too, because it's primordial to have IForgeMenuType with that :

public static final RegistryObject<MenuType<LightForgeMenu>> LIGHT_FORGE_MENU =
            MENUS.register("light_forge_menu", () -> IForgeMenuType.create(LightForgeMenu::new));


Thanks again and have a nice day/week/month/forever and ever

  • Like 1
Link to comment
Share on other sites

  • Florion111 changed the title to [1.20.2 - Solved] FriendlyByteBuff is null in constructor when using IForgeMenu.create for registration of custom menu type

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.