Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Solved] - Custom Furnace GUI - Entity Player

Featured Replies

Posted

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

 

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);

  • Author

Thanks,

 

Used the line you suggested and tweaked a few other bits and bobs, and it all works squiffily well now thanks :)

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.