Java tutorial
package com.ethylamine.fsynthesis.client.gui; /* * Copyright (c) 2014 Robin Glover * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 3 of the License, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, see <http://www.gnu.org/licenses>. */ import com.ethylamine.fsynthesis.block.machine.GeminiMachine; import com.ethylamine.fsynthesis.inventory.GeminiMachineContainer; import com.ethylamine.fsynthesis.tileentity.TileEntityGeminiMachine; import com.google.common.base.Objects; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; public class GeminiMachineGUI extends FluxianSynthesisGUI { private static final ResourceLocation TEXTURE = getResourceLocation(GeminiMachine.NAME); private final TileEntityGeminiMachine tileentity; public GeminiMachineGUI(InventoryPlayer playerInventory, TileEntityGeminiMachine tilentity) { super(new GeminiMachineContainer(playerInventory, tilentity)); this.tileentity = tilentity; } @Override protected void drawGuiContainerBackgroundLayer(float mouseX, int mouseZ, int renderPartialTicks) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.getTextureManager().bindTexture(TEXTURE); final int xStart = (width - xSize) / 2; final int yStart = (height - ySize) / 2; drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize); } @Override public String getInventoryName() { return tileentity.getInventoryName(); } @Override public String toString() { return Objects.toStringHelper(this).add("te", tileentity).toString(); } }