Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package cd4017be.automation.Gui; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import cd4017be.automation.TileEntity.ItemSorter; import cd4017be.lib.TileContainer; import cd4017be.lib.templates.GuiMachine; /** * * @author CD4017BE */ public class GuiItemSorter extends GuiMachine { private final ItemSorter tileEntity; public GuiItemSorter(ItemSorter tileEntity, EntityPlayer player) { super(new TileContainer(tileEntity, player)); this.tileEntity = tileEntity; } @Override public void initGui() { this.xSize = 176; this.ySize = 132; super.initGui(); } @Override protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.renderEngine.bindTexture(new ResourceLocation("automation", "textures/gui/itemSorter.png")); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); this.drawItemConfig(tileEntity, -54, 7); this.drawStringCentered(tileEntity.getInventoryName(), this.guiLeft + this.xSize / 2, this.guiTop + 4, 0x404040); this.drawStringCentered("Inventory", this.guiLeft + this.xSize / 2, this.guiTop + 36, 0x404040); } @Override protected void mouseClicked(int x, int y, int b) { super.mouseClicked(x, y, b); this.clickItemConfig(tileEntity, x - this.guiLeft + 54, y - this.guiTop - 7); } }