2014-12-15 00:11:48 +00:00
|
|
|
package com.cricketcraft.chisel.client.gui;
|
2014-10-27 16:26:14 -04:00
|
|
|
|
|
|
|
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
|
|
|
|
import net.minecraft.client.resources.I18n;
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
|
import net.minecraft.entity.player.InventoryPlayer;
|
2015-01-12 19:24:29 -05:00
|
|
|
import net.minecraft.inventory.Slot;
|
2014-12-14 20:05:39 +00:00
|
|
|
|
2014-10-27 16:26:14 -04:00
|
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
|
|
2014-12-15 00:11:48 +00:00
|
|
|
import com.cricketcraft.chisel.inventory.ContainerChisel;
|
|
|
|
|
import com.cricketcraft.chisel.inventory.InventoryChiselSelection;
|
2015-01-12 19:24:29 -05:00
|
|
|
import com.cricketcraft.chisel.inventory.SlotChiselInput;
|
2014-12-15 00:11:48 +00:00
|
|
|
import com.cricketcraft.chisel.utils.GeneralClient;
|
|
|
|
|
|
2015-01-07 19:50:18 -05:00
|
|
|
public class GuiChisel extends GuiContainer {
|
2014-10-27 16:26:14 -04:00
|
|
|
|
2015-01-07 19:50:18 -05:00
|
|
|
public EntityPlayer player;
|
|
|
|
|
public ContainerChisel container;
|
2014-10-27 16:26:14 -04:00
|
|
|
|
2015-01-07 19:50:18 -05:00
|
|
|
public GuiChisel(InventoryPlayer iinventory, InventoryChiselSelection menu) {
|
|
|
|
|
super(new ContainerChisel(iinventory, menu));
|
|
|
|
|
player = iinventory.player;
|
2015-01-12 19:24:29 -05:00
|
|
|
xSize = 252;
|
2015-01-12 20:42:32 -05:00
|
|
|
ySize = 202;
|
2014-10-27 16:26:14 -04:00
|
|
|
|
2015-01-07 19:50:18 -05:00
|
|
|
container = (ContainerChisel) inventorySlots;
|
|
|
|
|
}
|
2014-10-27 16:26:14 -04:00
|
|
|
|
2015-01-07 19:50:18 -05:00
|
|
|
@Override
|
|
|
|
|
public void onGuiClosed() {
|
|
|
|
|
super.onGuiClosed();
|
|
|
|
|
inventorySlots.onContainerClosed(player);
|
|
|
|
|
}
|
2014-10-27 16:26:14 -04:00
|
|
|
|
2015-01-07 19:50:18 -05:00
|
|
|
@Override
|
|
|
|
|
protected void drawGuiContainerForegroundLayer(int j, int i) {
|
|
|
|
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
2014-10-27 16:26:14 -04:00
|
|
|
|
2015-01-12 19:24:29 -05:00
|
|
|
String line = I18n.format(this.container.inventory.getInventoryName() + ".title");
|
|
|
|
|
fontRendererObj.drawSplitString(line, 50 - fontRendererObj.getStringWidth(line) / 2, 60, 40, 0x404040);
|
2015-01-07 19:50:18 -05:00
|
|
|
}
|
2014-10-27 16:26:14 -04:00
|
|
|
|
2015-01-07 19:50:18 -05:00
|
|
|
@Override
|
|
|
|
|
protected void drawGuiContainerBackgroundLayer(float f, int mx, int my) {
|
|
|
|
|
drawDefaultBackground();
|
|
|
|
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
2014-10-27 16:26:14 -04:00
|
|
|
|
2015-01-07 19:50:18 -05:00
|
|
|
int i = width - xSize >> 1;
|
|
|
|
|
int j = height - ySize >> 1;
|
2014-10-27 16:26:14 -04:00
|
|
|
|
2015-01-12 19:24:29 -05:00
|
|
|
String texture = "chisel:textures/chisel2Gui.png";
|
2015-01-07 19:50:18 -05:00
|
|
|
|
|
|
|
|
GeneralClient.bind(texture);
|
|
|
|
|
drawTexturedModalRect(i, j, 0, 0, xSize, ySize);
|
|
|
|
|
}
|
2015-01-12 19:24:29 -05:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void func_146977_a(Slot slot) {
|
|
|
|
|
if (slot instanceof SlotChiselInput) {
|
|
|
|
|
GL11.glPushMatrix();
|
|
|
|
|
GL11.glScalef(2, 2, 2);
|
|
|
|
|
slot.xDisplayPosition -= 16;
|
|
|
|
|
slot.yDisplayPosition -= 16;
|
|
|
|
|
super.func_146977_a(slot);
|
|
|
|
|
slot.xDisplayPosition += 16;
|
|
|
|
|
slot.yDisplayPosition += 16;
|
|
|
|
|
GL11.glPopMatrix();
|
|
|
|
|
} else {
|
|
|
|
|
super.func_146977_a(slot);
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-10-27 16:26:14 -04:00
|
|
|
}
|