package noppes.npcs.client.gui.player; import net.minecraft.client.gui.GuiButton; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import noppes.npcs.client.CustomNpcResourceListener; import noppes.npcs.client.gui.util.GuiContainerNPCInterface; import noppes.npcs.client.gui.util.GuiNpcButton; import noppes.npcs.containers.ContainerCarpentryBench; import noppes.npcs.controllers.RecipeController; import org.lwjgl.opengl.GL11; public class GuiNpcCarpentryBench extends GuiContainerNPCInterface { private final ResourceLocation resource = new ResourceLocation("customnpcs", "textures/gui/carpentry.png"); private ContainerCarpentryBench container; private GuiNpcButton button; public GuiNpcCarpentryBench(ContainerCarpentryBench container) { super(null, container); this.container = container; this.title = ""; allowUserInput = false;//allowUserInput closeOnEsc = true; ySize = 180; } @Override public void initGui() { super.initGui(); addButton(button = new GuiNpcButton(0, guiLeft + 158, guiTop + 4, 12, 20, "...")); } public void buttonEvent(GuiButton guibutton) { displayGuiScreen(new GuiRecipes()); } @Override protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { button.enabled = RecipeController.Instance != null && !RecipeController.Instance.carpentryRecipes.isEmpty(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(resource); int l = (width - xSize) / 2; int i1 = (height - ySize) / 2; String title = StatCollector.translateToLocal("tile.npcCarpentyBench.name"); if (container.getMetadata() >= 4) title = StatCollector.translateToLocal("tile.anvil.name"); drawTexturedModalRect(l, i1, 0, 0, xSize, ySize); super.drawGuiContainerBackgroundLayer(f, i, j); if (!container.canPickupResult()) { drawRedSlotOutline(guiLeft + 133, guiTop + 41); } fontRendererObj.drawString(title, guiLeft + 4, guiTop + 4, CustomNpcResourceListener.DefaultTextColor); fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), guiLeft + 4, guiTop + 87, CustomNpcResourceListener.DefaultTextColor); } private void drawRedSlotOutline(int x, int y) { int c = 0xFFFF0000; drawRect(x - 1, y - 1, x + 17, y, c); drawRect(x - 1, y + 16, x + 17, y + 17, c); drawRect(x - 1, y, x, y + 16, c); drawRect(x + 16, y, x + 17, y + 16, c); } @Override public void save() { return; } }