Jump to content

Recommended Posts

Posted

Hi hello, I continued with my mod, and now I'm telling to the blocks that they are

crafting stations to display the crafting table ui. I was reading the code of the

Workbench block and I saw this code

 

 

 

  /**

    * 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

        {

            par5EntityPlayer.displayGUIWorkbench(par2, par3, par4);

            return true;

        }

    }

 

 

 

So I decided to add this code to my block to see what happen, but the code is not working.

My block is a custom block with custom model but is an extension of the minecraft block.

 

I did a short modification in the code

 

 

 

  /**

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

    {

        {

            par5EntityPlayer.displayGUIWorkbench(par2, par3, par4);

            return true;

        }

    }

 

 

 

With the modification my crafting table is working but the ui is opening for half a second and after that

the game is closing the ui so you can't use the ui...

 

If someone can help me... I need a hand again sorry is my first crafting table and I'm looking for information.

 

Thanks.

Posted

For my block with Guis I have a gui handler and then instead of the modifiaction of the player.openGui you should have

FMLNetworkHandler.openGui(player, mod.instance, GuiID, world, x, y, z);

Don't be afraid to ask question when modding, there are no stupid question! Unless you don't know java then all your questions are stupid!

Posted

Omg, is so complex to create a whole new crafting table... I was thinking in using the minecraft workbench ui  to try to do the things more easy, but I'm watching that create a custom crafting table is going to be another real pain....

 

Anyone know a good tutorial about that for mc 1.6 series ? 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...

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