Jump to content

[1.8.9] GuiHandler doesn't register correctly


Matthbo

Recommended Posts

Hello, I'm having a strange problem

I'm trying to open a gui when I rightclick a block, the problem is that nothing happens.

I did some research and found that forge sees my GuiHandler class but doesn't register the getServerGuiElement & getClientGuiElement methods.

Did I do something wrong?

 

GuiHandler:

public class GuiHandler implements IGuiHandler {

    @Override
    public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
        return null;
    }

    @Override
    public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
        if(ID == 10) return new GuiMachineBlock();
        return null;
    }
}

 

Init:

@Mod.EventHandler
    public void init(FMLInitializationEvent event){
        proxy.init();
        NetworkRegistry.INSTANCE.registerGuiHandler(MatthProject.instance, new GuiHandler());
    }

 

Debug:

asyVVbO.png

Link to comment
Share on other sites

I do call openGui:

 

@Override
    public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
        if(!world.isRemote) {
            player.openGui(MatthProject.instance, 10, world, pos.getX(), pos.getY(), pos.getZ());
            //FMLNetworkHandler.openGui(player, MatthProject.instance, 10, world, pos.getX(), pos.getY(), pos.getZ());
        }
        return true;
    }

 

But I believe this is not the problem, I did everything as I used to do on a 1.7 mod.

I didn't find any changes for 1.8.9 on the internet.

 

For more code visit my github repo: https://github.com/Matthbo/MatthProject

Link to comment
Share on other sites

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.