Skip to content

Instantly share code, notes, and snippets.

@JayZX535
Created April 4, 2019 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JayZX535/3561ee7b94baae1fa38d19286e124924 to your computer and use it in GitHub Desktop.
Save JayZX535/3561ee7b94baae1fa38d19286e124924 to your computer and use it in GitHub Desktop.
package com.wildcraft.wildcraft.client.gui;
import com.wildcraft.wildcraft.WildCraft;
import com.wildcraft.wildcraft.container.ContainerFoodDish;
import com.wildcraft.wildcraft.tileentity.TileEntityFoodDish;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.ResourceLocation;
public class GUIFoodDish extends GuiContainer{
private TileEntityFoodDish fooddish;
private IInventory playerInv;
public GUIFoodDish(IInventory playerInv, TileEntityFoodDish fooddish) {
super(new ContainerFoodDish(playerInv, fooddish));
this.xSize = 175;
this.ySize = 179;
this.fooddish = fooddish;
this.playerInv = playerInv;
// TODO Auto-generated constructor stub
}
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks,int mouseX, int mouseY) {
GlStateManager.color(1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(new ResourceLocation(WildCraft.MODID, "textures/gui/food_dish_gui.png"));
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
String s = I18n.format("container.food_dish"); //Gets the formatted name for the block breaker from the language file - NOTE ADD "container.block_breaker=Block Breaker" to the language file (without quotes) and then delete this note
this.mc.fontRendererObj.drawString(s, this.xSize / 2 - this.mc.fontRendererObj.getStringWidth(s) / 2, 6, 4210752); //Draws the block breaker name in the center on the top of the gui
this.mc.fontRendererObj.drawString(this.playerInv.getDisplayName().getFormattedText(), 8, 72, 4210752); //The player's inventory name
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment