61 lines
2.1 KiB
Java
61 lines
2.1 KiB
Java
package gp_dbc.gui.JailManager;
|
|
|
|
import gp_dbc.Main;
|
|
import gp_dbc.system.Cell;
|
|
import net.minecraft.client.Minecraft;
|
|
import net.minecraft.client.gui.GuiButton;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.util.ResourceLocation;
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
import static gp_dbc.utils.DrawGui.drawLimited;
|
|
|
|
public class GuiButtonJailManager extends GuiButton {
|
|
|
|
private static final ResourceLocation buttonTexturesNinjin = new ResourceLocation(Main.MODID, "textures/gui/jailManager.png");
|
|
ItemStack stack;
|
|
|
|
public GuiButtonJailManager(int buttonId, int x, int y, int width, int height)
|
|
{
|
|
super(buttonId, x, y, "");
|
|
this.enabled = true;
|
|
this.visible = true;
|
|
this.id = buttonId;
|
|
this.xPosition = x;
|
|
this.yPosition = y;
|
|
this.width = width;
|
|
this.height = height;
|
|
}
|
|
|
|
/**
|
|
* Draws this button to the screen.
|
|
**/
|
|
@Override
|
|
public void drawButton(Minecraft minecraft, int x, int y) {
|
|
if (!this.visible)
|
|
return;
|
|
|
|
minecraft.getTextureManager().bindTexture(buttonTexturesNinjin);
|
|
|
|
boolean flag = x >= this.xPosition && y >= this.yPosition && x < this.xPosition + this.width && y < this.yPosition + this.height;
|
|
if (id < 0) { // cells
|
|
GL11.glPushMatrix();
|
|
|
|
if (flag) {
|
|
drawRect(xPosition, yPosition, xPosition + width, yPosition + height, 0xffd6d6d6);
|
|
//this.drawTexturedModalRect(this.xPosition, this.yPosition, 130, 7, this.width, this.height);
|
|
}
|
|
else {
|
|
drawRect(xPosition, yPosition, xPosition + width, yPosition + height, 0xffffffff);
|
|
//this.drawTexturedModalRect(this.xPosition, this.yPosition, 130, 7, this.width, this.height);
|
|
}
|
|
Cell cell = GuiJailManager.cells.get(-(id) - 1);
|
|
|
|
drawLimited(minecraft.fontRenderer, "Cell #" + -(id) + " " + cell.getInmates().size() + "/" + cell.getPlace(), xPosition, yPosition, width - 1, height, 0xff000000);
|
|
|
|
GL11.glPopMatrix();
|
|
}
|
|
}
|
|
|
|
}
|