Jump to content

[Solved] - Custom Furnace GUI - Entity Player


pmardle

Recommended Posts

Ok,

 

I have part of a mod that uses a tweaked furnace for something..

 

The section of code throwing my only error at this time is below

 

<iframe src="http://paste.minecraftforge.net/view/embed/312d2972" style="border:none;width:100%"></iframe>

 

<Edit> - Pfft so much for the embed working :P

 

    /**

    * Called upon block activation (right click on the block.)

    */

    public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)

    {

        if (par1World.isRemote)

        {

            return true;

        }

        else

        {

            TileEntityResearchBlock var10 = (TileEntityResearchBlock)par1World.getBlockTileEntity(par2, par3, par4);

 

            if (var10 != null)

            {

                par5EntityPlayer.displayGUIResearchBlock(var10);

            }

 

            return true;

        }

    }

 

The Error is:-

 

The method displayGUIResearchBlock(TileEntityResearchBlock) is undefined for the type EntityPlayer

 

Now,

 

I understand that this is saying the GUIResearchBlock is not defined in the EntityPlayer file, but I don't want to directly change this base file.

 

Can anyone explain, or point me to something that will tell me how to get this working please.. I've searched many GUI tutorials with no luck.

 

Thanks in advance,

 

pmardle

 

Link to comment
Share on other sites

You need to have a class that implements IGuiHandler, look it up to understand how to use it. Essentially you have a IGuiHandler that takes a ID specific for the GUI you want to open, and returns the GUI object on the client, and the container object on the server. You register this handler with your NetworkRegistry, and then you can open the GUI from your block by calling

 

par5EntityPlayer.openGui(MyMod.instance, 0/*this is the gui-specific ID, pick whatever you want*/, par1World, par2, par3, par4);

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.