I am having a problem on the gui of a custom furnace that I've made. Everything is working fine, the program doesn't have errors, the gui is working as I expected but it doesn't show the name of the block on top like the vanilla furnace do. I've searched everywhere and I've tried to do everything but it still doesn't work.
Here is the gui class:
package lassisolet.grandchasemod.gui;
import org.lwjgl.opengl.GL11;
import com.sun.prism.paint.Color;
import lassisolet.grandchase.tileentity.TileEntityFornalhaDoAcoNegro;
import lassisolet.grandchasemod.lib.Strings;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.util.ResourceLocation;
import lassisolet.grandchasemod.Container.ContainerFornalhaDeAcoNegro;
public class GuiFornalhaDeAcoNegro extends GuiContainer
{
public static final ResourceLocation bground = new ResourceLocation(Strings.MODID + ":" + "textures/gui/Black_Steel_Furnace_Gui.png");
public TileEntityFornalhaDoAcoNegro fornalhadeaconegro;
public GuiFornalhaDeAcoNegro(InventoryPlayer inventoryPlayer, TileEntityFornalhaDoAcoNegro entity) {
super(new ContainerFornalhaDeAcoNegro(inventoryPlayer, entity));
this.fornalhadeaconegro = entity;
this.xSize = 176;
this.ySize = 166;
}
//here is where I setup the name to render in the gui
public void drawGuiContainerForgroundLayer(int par1, int par2)
{
String name = this.fornalhadeaconegro.hasCustomInventoryName() ? this.fornalhadeaconegro.getInventoryName() : I18n.format(this.fornalhadeaconegro.getInventoryName(), new Object[0]);
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, Color.BLACK.hashCode());
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, Color.BLACK.hashCode());
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GL11.glColor4f(1F, 1F, 1F, 1F);
Minecraft.getMinecraft().getTextureManager().bindTexture(bground);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
}
}
Thanks. I dont know what actually happened but I was able to see the code form the tutorial that I followed and I tried using his to see if works and it worked !
Hello guys,
I am having a problem on the gui of a custom furnace that I've made. Everything is working fine, the program doesn't have errors, the gui is working as I expected but it doesn't show the name of the block on top like the vanilla furnace do. I've searched everywhere and I've tried to do everything but it still doesn't work.
Here is the gui class:
Thank you for the help
You should always use the @Override annotation when overriding methods. Try using that, if there are some mistakes it will help you locate them
Get my mod here: Official site
What version of Minecraft are you using? It appears as though it's 1.7.10, no? If so, this bit of code doesn't look right.
Try this instead
Thanks. I dont know what actually happened but I was able to see the code form the tutorial that I followed and I tried using his to see if works and it worked !
What did you add, or remove, from the above code to make it work properly?
Please mark this post as [Solved], or [Resolved], if everything is working as it should, thanks.
Stone Miner, this is the new code: