Jump to content

Making GUI with forge


chewdri

Recommended Posts

Hi I would know, what is the code for open a specific Gui when a player right click with a specific object.

I know the code with modloader but not the one with forge

 

public class livredecartes extends Item
{
    public livredecartes(int i)
    {
        super(i);
        maxStackSize = 64;
        this.setCreativeTab(CreativeTabs.tabMaterials);
    }

    public String getTextureFile()
    {
            return "/chewdri/harrypotterv2/client/Items.png";
    }
    
    public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
    {
    ModLoader.openGUI(par2EntityPlayer,new GuiWithButtonr(par2EntityPlayer)); 
    return true;
    }
}

 

 

Link to comment
Share on other sites

I tried

 

public boolean onItemUse(World world, int x, int y, int z, EntityPlayer player, int i, float f, float g, float t)
    {
            
   
    	player.openGui(harrypotterv2.instance, GuiWithButtonr.ID, world, 0, 0, 0);
            return true;
            }
    
    
}

 

0 errors, but I open anything when I right click with my item

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

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