use of mods.railcraft.common.gui.slots.SlotRailcraft in project Railcraft by Railcraft.
the class GuiContainerRailcraft method drawScreen.
/**
* Draws the screen and all the components in it.
*/
@Override
public void drawScreen(int mouseX, int mouseY, float par3) {
super.drawScreen(mouseX, mouseY, par3);
int left = guiLeft;
int top = guiTop;
OpenGL.glDisable(GL11.GL_LIGHTING);
OpenGL.glDisable(GL11.GL_DEPTH_TEST);
OpenGL.glPushMatrix();
OpenGL.glTranslatef((float) left, (float) top, 0.0F);
OpenGL.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
RenderHelper.disableStandardItemLighting();
InventoryPlayer playerInv = mc.thePlayer.inventory;
if (playerInv.getItemStack() == null) {
int mX = mouseX - left;
int mY = mouseY - top;
for (Widget element : container.getWidgets()) {
if (element.hidden)
continue;
ToolTip tips = element.getToolTip();
if (tips == null)
continue;
boolean mouseOver = element.isMouseOver(mX, mY);
tips.onTick(mouseOver);
if (mouseOver && tips.isReady()) {
tips.refresh();
drawToolTips(tips, mouseX, mouseY);
}
}
for (Object button : buttonList) {
if (!(button instanceof GuiBetterButton))
continue;
GuiBetterButton betterButton = (GuiBetterButton) button;
if (!betterButton.visible)
continue;
ToolTip tips = betterButton.getToolTip();
if (tips == null)
continue;
boolean mouseOver = betterButton.isMouseOverButton(mouseX, mouseY);
tips.onTick(mouseOver);
if (mouseOver && tips.isReady()) {
tips.refresh();
drawToolTips(tips, mouseX, mouseY);
}
}
for (Object obj : inventorySlots.inventorySlots) {
if (!(obj instanceof SlotRailcraft))
continue;
SlotRailcraft slot = (SlotRailcraft) obj;
if (slot.getStack() != null)
continue;
ToolTip tips = slot.getToolTip();
if (tips == null)
continue;
boolean mouseOver = isMouseOverSlot(slot, mouseX, mouseY);
tips.onTick(mouseOver);
if (mouseOver && tips.isReady()) {
tips.refresh();
drawToolTips(tips, mouseX, mouseY);
}
}
}
OpenGL.glPopMatrix();
OpenGL.glEnable(GL11.GL_LIGHTING);
OpenGL.glEnable(GL11.GL_DEPTH_TEST);
}
use of mods.railcraft.common.gui.slots.SlotRailcraft in project Railcraft by Railcraft.
the class GuiContainerRailcraft method mouseClickMove.
@Override
protected void mouseClickMove(int x, int y, int mouseButton, long time) {
Slot slot = getSlotAtPosition(x, y);
if (mouseButton == 1 && slot instanceof SlotRailcraft && ((SlotRailcraft) slot).isPhantom())
return;
super.mouseClickMove(x, y, mouseButton, time);
}
use of mods.railcraft.common.gui.slots.SlotRailcraft in project Railcraft by Railcraft.
the class ContainerLocomotive method init.
public final void init() {
defineSlotsAndWidgets();
SlotRailcraft slotTicket = new SlotStackFilter(ItemTicket.FILTER, loco, loco.getSizeInventory() - 2, 116, guiHeight - 111) {
@Override
public int getSlotStackLimit() {
return 1;
}
};
slotTicket.setToolTips(ToolTip.buildToolTip("gui.locomotive.tips.slot.ticket"));
addSlot(slotTicket);
// TODO: make some way to clear this?
addSlot(new SlotUntouchable(loco, loco.getSizeInventory() - 1, 134, guiHeight - 111));
for (int i = 0; i < 3; i++) {
for (int k = 0; k < 9; k++) {
addSlot(new Slot(playerInv, k + i * 9 + 9, 8 + k * 18, guiHeight - 82 + i * 18));
}
}
for (int j = 0; j < 9; j++) {
addSlot(new Slot(playerInv, j, 8 + j * 18, guiHeight - 24));
}
}
Aggregations