Jump to content

GuiScreen Buttons won't Show


shucke

Recommended Posts

When im opening my GuiScreen my buttons wont showup but the background does.

but i can still click the buttons if i click with the mouse where the buttons should be.

I did registered my IGui Handler so there shouldn't be a problem there.

 

anyway here is my code:

 

CommonProxy Class

 

package legendz.common;

 

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.world.World;

import cpw.mods.fml.common.network.IGuiHandler;

 

public class CommonProxy implements IGuiHandler{

 

public void registerRenderInformation(){

 

}

 

@Override

public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {

TileEntity te = world.getBlockTileEntity(x, y, z);

if(te != null){

switch(ID){

case 0: return null;

 

case 1: return new ContainerLegendzCraftingTable(player.inventory, (TileEntityLegendzCraftingTable)te);

}

 

}

return null;

}

 

@Override

public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {

TileEntity te = world.getBlockTileEntity(x, y, z);

if(te != null){

switch(ID){

case 0: return new GuiLegendzCraftingTable(player.inventory, (TileEntityLegendzCraftingTable)te);

}

}

return null;

}

 

}

 

 

 

Gui Class

 

package legendz.common;

 

import net.minecraft.client.gui.GuiButton;

import net.minecraft.client.gui.GuiScreen;

import net.minecraft.entity.player.InventoryPlayer;

import net.minecraft.util.StatCollector;

import org.lwjgl.opengl.GL11;

 

public class GuiLegendzCraftingTable extends GuiScreen

{

    private TileEntityLegendzCraftingTable inventory;

   

    private GuiButton button1;

private GuiButton button2;

private GuiButton button3;

private GuiButton button4;

   

   

    public GuiLegendzCraftingTable(InventoryPlayer par1InventoryPlayer, TileEntityLegendzCraftingTable te)

    {

        //this.inventory = te;

    }

   

    public void initGui(){

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    controlList.clear();

    controlList.add(button1 = new GuiButton(1, width / 2 - 60, height / 2 +60, "jhk"));

    controlList.add(button2 = new GuiButton(2, width / 2 + 60, height / 2 +60, "bjh"));

    button1.drawButton = true;

    button2.drawButton = true;

    button1.drawButton(mc, width, height);

    }

   

    protected void actionPerformed(GuiButton guiButton){

 

}

 

    public void drawScreen(int par1, int par2, float f)

    {

        drawDefaultBackground();

        int var4 = this.mc.renderEngine.getTexture("/legendz/resources/gui/craftingSelection.png");

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

        this.mc.renderEngine.bindTexture(var4);

        int var5 = width / 2 - 88;

        int var6 = height / 2 - 112;

        this.drawTexturedModalRect(var5, var6, 0, 0, 176, 224);

    }

}

 

 

 

 

Block Class

 

package legendz.common;

 

import java.io.ByteArrayOutputStream;

import java.io.DataOutputStream;

 

import cpw.mods.fml.common.FMLCommonHandler;

import cpw.mods.fml.common.network.FMLNetworkHandler;

import cpw.mods.fml.common.network.PacketDispatcher;

import cpw.mods.fml.common.network.Player;

import cpw.mods.fml.relauncher.Side;

import net.minecraft.block.Block;

import net.minecraft.block.BlockContainer;

import net.minecraft.block.material.Material;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.entity.player.EntityPlayerMP;

import net.minecraft.network.packet.Packet250CustomPayload;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.world.World;

 

public class BlockLegendzCraftingTable extends BlockContainer{

 

public BlockLegendzCraftingTable(int par1, Material par2Material) {

super(par1, 1 ,par2Material);

this.setHardness(0.8f);

this.setCreativeTab(getCreativeTabToDisplayOn().tabDecorations);

}

 

public int getBlockTextureFromSide(int i){

if(i == 0){

return 0;

}

if(i == 1){

return 0;

}

return 1;

}

 

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

TileEntityLegendzCraftingTable obj = (TileEntityLegendzCraftingTable)par1World.getBlockTileEntity(par2, par3, par4);

if(obj!=null){

FMLNetworkHandler.openGui(par5EntityPlayer, BaseLegendz.LegendzInstance, 0, par1World, par2, par3, par4);

}

return true;

}

 

public String getTextureFile(){

return BaseLegendz.PNGBlock;

}

 

@Override

public TileEntity createNewTileEntity(World var1) {

return new TileEntityLegendzCraftingTable();

}

 

}

 

 

 

BaseMod Class

 

@Init

public void Load(FMLInitializationEvent evt){

proxy.registerRenderInformation();

NetworkRegistry.instance().registerGuiHandler(LegendzInstance, proxy);

GameRegistry.registerWorldGenerator(new WorldGenerator());

RegisterBlocks();

RegisterTileEntitys();

//AddSmelting();

AddRecipes();

}

 

 

my container gui's work but this one doesn't.

i tried to figure it out by mself but i can't figgure out what's wrong.

no errors in eclipse to.

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.



×
×
  • Create New...

Important Information

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