parent
4a645cd035
commit
3206c61a9e
@ -0,0 +1,59 @@
|
||||
package net.brokenmoon.afloydironchest.gui;
|
||||
|
||||
import net.minecraft.src.*;
|
||||
|
||||
public class ContainerWideChest extends Container {
|
||||
private IInventory inventory;
|
||||
private int numberOfRowsLower = 4;
|
||||
private int numberOfRowsUpper;
|
||||
|
||||
public ContainerWideChest(IInventory lowerInventory, IInventory upperInventory) {
|
||||
this.inventory = upperInventory;
|
||||
this.numberOfRowsUpper = upperInventory.getSizeInventory() / 12;
|
||||
int i = (this.numberOfRowsUpper - 4) * 18;
|
||||
//Upper
|
||||
for (int j = 0; j < this.numberOfRowsUpper; ++j) {
|
||||
for (int i1 = 0; i1 < 12; ++i1) {
|
||||
this.addSlot(new Slot(upperInventory, i1 + j * 12, -18 - 6 + i1 * 18, -36 + j * 18));
|
||||
}
|
||||
}
|
||||
//Lower
|
||||
for (int k = 0; k < 3; ++k) {
|
||||
for (int j1 = 0; j1 < 9; ++j1) {
|
||||
this.addSlot(new Slot(lowerInventory, j1 + k * 9 + 9, 3 + j1 * 18, 49 + k * 18 + i));
|
||||
}
|
||||
}
|
||||
//Taskbar
|
||||
for (int l = 0; l < 9; ++l) {
|
||||
this.addSlot(new Slot(lowerInventory, l, 3 + l * 18, 49 + 18 * 3 + 4 + i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsableByPlayer(EntityPlayer entityplayer) {
|
||||
return this.inventory.canInteractWith(entityplayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void quickMoveItems(int slotID, EntityPlayer player, boolean shift, boolean control) {
|
||||
Slot slot = (Slot)this.inventorySlots.get(slotID);
|
||||
if (slot == null || !slot.hasStack()) {
|
||||
return;
|
||||
}
|
||||
ItemStack item = slot.getStack();
|
||||
ItemStack originalItem = item.copy();
|
||||
if (slotID < this.numberOfRowsUpper * 12) {
|
||||
this.onStackMergeShiftClick(item, this.numberOfRowsUpper * 12, this.inventorySlots.size(), true);
|
||||
} else {
|
||||
this.onStackMergeShiftClick(item, 0, this.numberOfRowsUpper * 12, false);
|
||||
}
|
||||
if (item.stackSize == 0) {
|
||||
slot.putStack(null);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
if (item.stackSize != originalItem.stackSize) {
|
||||
slot.onPickupFromSlot(item);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package net.brokenmoon.afloydironchest.gui;
|
||||
|
||||
import net.minecraft.src.GuiContainer;
|
||||
import net.minecraft.src.IInventory;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiDiamondChest extends GuiContainer {
|
||||
private IInventory upperChestInventory;
|
||||
private IInventory lowerChestInventory;
|
||||
private int inventoryRows;
|
||||
|
||||
public int xSize = 240;
|
||||
public int ySize = 222;
|
||||
|
||||
public GuiDiamondChest(IInventory iinventory, IInventory iinventory1) {
|
||||
super(new ContainerWideChest(iinventory, iinventory1));
|
||||
this.upperChestInventory = iinventory;
|
||||
this.lowerChestInventory = iinventory1;
|
||||
this.field_948_f = false;
|
||||
int c = 222;
|
||||
int i = c - 108;
|
||||
this.inventoryRows = iinventory1.getSizeInventory() / 12;
|
||||
this.ySize = i + this.inventoryRows * 18;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer() {
|
||||
this.fontRenderer.drawString(this.lowerChestInventory.getInvName(), -24, -47, 0x404040);
|
||||
this.fontRenderer.drawString(this.upperChestInventory.getInvName(), 3, 128, 0x404040);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f) {
|
||||
int i = this.mc.renderEngine.getTexture("/assets/ironchest/gui/containerWide.png");
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
this.mc.renderEngine.bindTexture(i);
|
||||
int x = (this.width - this.xSize) / 2;
|
||||
int y = (this.height - this.ySize) / 2;
|
||||
int h1 = Math.min(this.inventoryRows, 6) * 18 + 17;
|
||||
this.drawTexturedModalRect(x, y, 0, 0, this.xSize, h1);
|
||||
int rows = this.inventoryRows;
|
||||
while (rows > 6) {
|
||||
int h2 = Math.min(rows, 6) * 18;
|
||||
this.drawTexturedModalRect(x, y + h1, 0, 17, this.xSize, h2);
|
||||
rows -= 6;
|
||||
h1 += h2;
|
||||
}
|
||||
this.drawTexturedModalRect(x, y + this.inventoryRows * 18 + 17, 0, 126, this.xSize, 96);
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
Loading…
Reference in New Issue