Jump to content

DrawString on GUI (SOLVED)


wiffington

Recommended Posts

I am using this to draw a string onto my GUI but it does not show up.

 

public void drawGuiConatinerForegroundLayer(int par1, int par2){
	//This gets the name so when we open the gui it says Grinder
	String name = "Grinder";

	//sets where it says Grinder
	this.fontRendererObj.drawString(name,80, 6, 4210752);

	//sets where it says Inventory
	this.fontRendererObj.drawString("Inventory", 128, this.ySize - 96 + 2, 4210752);
}

Link to comment
Share on other sites

Here ya go.

package com.wiffington.pizzeria.gui;

import org.lwjgl.opengl.GL11;

import com.wiffington.pizzeria.Main;
import com.wiffington.pizzeria.container.ContainerGrinder;
import com.wiffington.pizzeria.tileentity.TileEntityGrinder;

import javafx.scene.paint.Color;
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.util.ResourceLocation;

public class GuiGrinder extends GuiContainer{

public static final ResourceLocation bground = new ResourceLocation(Main.MODID + ":"+"textures/gui/guiGrinder.png");

public TileEntityGrinder grinder;

public GuiGrinder(InventoryPlayer inventoryPlayer,TileEntityGrinder entity) {
	super(new ContainerGrinder(inventoryPlayer, entity));

	this.grinder = entity;

	//size of gui
	this.xSize = 176;
	this.ySize = 166;
}

public void drawGuiConatinerForegroundLayer(int par1, int par2){
	//This gets the name so when we open the gui it says Grinder
	String name = "Grinder";

	//sets where it says Grinder
	this.fontRendererObj.drawString(name,80, 6, 4210752);

	//sets where it says Inventory
	this.fontRendererObj.drawString("Inventory", 128, this.ySize - 96 + 2, 4210752);
}

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

	int k = (this.width - this.xSize) / 2;
	int l = (this.height - this.ySize) / 2;
	if(this.grinder.isPowered()){

		int k1 = this.grinder.getCookProgressScaled(24);
		System.out.println(k1);
		drawTexturedModalRect(guiLeft+79, guiTop+21, 176, 0, k1+1, 29);
	}


}

}

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.

Announcements



×
×
  • Create New...

Important Information

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