mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-19 19:59:58 +00:00
Fixed armor slots on cap bank dropping items when armor is selected.
This commit is contained in:
1 parent
11be5dc6a6
commit
1bfe73ded2
8 files changed
+49
-24
No files matched your search
@@ -56,7 +56,7 @@ public class GuiOverlayIoConfig implements IGuiOverlay {
|
||||
|
||||
};
|
||||
renderer.init();
|
||||
bounds = new Rectangle(5, screen.getYSize() - height -5, screen.getXSize() - 10, height);
|
||||
bounds = new Rectangle(screen.getOverlayOffsetX() + 5, screen.getYSize() - height -5, screen.getXSize() - 10, height);
|
||||
}
|
||||
|
||||
protected String getLabelForMode(IoMode mode) {
|
||||
@@ -70,7 +70,7 @@ public class GuiOverlayIoConfig implements IGuiOverlay {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
|
||||
int vpx = ( (screen.getGuiLeft() + bounds.x)* scaledresolution.getScaleFactor());
|
||||
int vpx = ( (screen.getGuiLeft() + bounds.x - screen.getOverlayOffsetX())* scaledresolution.getScaleFactor());
|
||||
int vpy = (screen.getGuiTop() + 4) * scaledresolution.getScaleFactor();
|
||||
int w = bounds.width * scaledresolution.getScaleFactor();
|
||||
int h = bounds.height * scaledresolution.getScaleFactor();
|
||||
|
||||
@@ -433,4 +433,11 @@ public class GuiHyperCube extends GuiScreenBase {
|
||||
return Minecraft.getMinecraft().fontRenderer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOverlayOffsetX() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -148,6 +148,11 @@ public class GuiPowerMonitor extends GuiScreenBase {
|
||||
endTF.updateCursorCounter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOverlayOffsetX() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int par3) {
|
||||
super.mouseClicked(x, y, par3);
|
||||
|
||||
@@ -18,29 +18,29 @@ public class ContainerCapacitorBank extends Container {
|
||||
public ContainerCapacitorBank(final Entity player, InventoryPlayer playerInv, TileCapacitorBank te) {
|
||||
|
||||
tileEntity = te;
|
||||
|
||||
addSlotToContainer(new Slot(tileEntity, 0, 59, 59) {
|
||||
int armorOffset = 21;
|
||||
addSlotToContainer(new Slot(tileEntity, 0, 59 + armorOffset, 59) {
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack itemStack) {
|
||||
return tileEntity.isItemValidForSlot(0, itemStack);
|
||||
}
|
||||
});
|
||||
|
||||
addSlotToContainer(new Slot(tileEntity, 1, 79, 59) {
|
||||
addSlotToContainer(new Slot(tileEntity, 1, 79 + armorOffset, 59) {
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack itemStack) {
|
||||
return tileEntity.isItemValidForSlot(1, itemStack);
|
||||
}
|
||||
});
|
||||
|
||||
addSlotToContainer(new Slot(tileEntity, 2, 99, 59) {
|
||||
addSlotToContainer(new Slot(tileEntity, 2, 99 + armorOffset, 59) {
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack itemStack) {
|
||||
return tileEntity.isItemValidForSlot(2, itemStack);
|
||||
}
|
||||
});
|
||||
|
||||
addSlotToContainer(new Slot(tileEntity, 3, 119, 59) {
|
||||
addSlotToContainer(new Slot(tileEntity, 3, 119 + armorOffset, 59) {
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack itemStack) {
|
||||
return tileEntity.isItemValidForSlot(3, itemStack);
|
||||
@@ -50,18 +50,18 @@ public class ContainerCapacitorBank extends Container {
|
||||
// add players inventory
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, + armorOffset + 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 142));
|
||||
addSlotToContainer(new Slot(playerInv, i, + armorOffset + 8 + i * 18, 142));
|
||||
}
|
||||
|
||||
//armor slots
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
final int k = i;
|
||||
addSlotToContainer(new Slot(playerInv, playerInv.getSizeInventory() - 1 - i, - 15, 30 + i * 18) {
|
||||
addSlotToContainer(new Slot(playerInv, playerInv.getSizeInventory() - 1 - i, -15 + armorOffset, 30 + i * 18) {
|
||||
|
||||
@Override
|
||||
public int getSlotStackLimit() {
|
||||
@@ -70,7 +70,7 @@ public class ContainerCapacitorBank extends Container {
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
if (par1ItemStack == null) {
|
||||
if(par1ItemStack == null) {
|
||||
return false;
|
||||
}
|
||||
return par1ItemStack.getItem().isValidArmor(par1ItemStack, k, player);
|
||||
|
||||
@@ -36,19 +36,19 @@ public class GuiCapacitorBank extends GuiContainerBase {
|
||||
|
||||
protected static final int CONFIG_ID = 377996104;
|
||||
|
||||
private static final int POWER_X = 8;
|
||||
private static final int POWER_X = 8 + 21;
|
||||
private static final int POWER_Y = 9;
|
||||
private static final int POWER_WIDTH = 10;
|
||||
private static final int POWER_HEIGHT = 68;
|
||||
protected static final int BOTTOM_POWER_Y = POWER_Y + POWER_HEIGHT;
|
||||
|
||||
private int inputX = 78;
|
||||
private int inputX = 78 + 24;
|
||||
private int inputY = 18;
|
||||
|
||||
private int outputX = 78;
|
||||
private int outputX = 78 + 24;
|
||||
private int outputY = 36;
|
||||
|
||||
private int rightMargin = 8;
|
||||
private int rightMargin = 8 + 24;
|
||||
|
||||
private final TileCapacitorBank capBank;
|
||||
|
||||
@@ -65,6 +65,8 @@ public class GuiCapacitorBank extends GuiContainerBase {
|
||||
super(new ContainerCapacitorBank(player, playerInv, te));
|
||||
this.capBank = te;
|
||||
|
||||
xSize = 176 + 42;
|
||||
|
||||
addToolTip(new GuiToolTip(new Rectangle(POWER_X, POWER_Y, POWER_WIDTH, POWER_HEIGHT), "") {
|
||||
|
||||
@Override
|
||||
@@ -76,7 +78,7 @@ public class GuiCapacitorBank extends GuiContainerBase {
|
||||
|
||||
});
|
||||
|
||||
int x = xSize - rightMargin - GuiMachineBase.BUTTON_SIZE;
|
||||
int x = xSize - rightMargin - GuiMachineBase.BUTTON_SIZE - 21;
|
||||
int y = inputY;
|
||||
inputRsButton = new RedstoneModeButton(this, -1, x, y, new IRedstoneModeControlable() {
|
||||
|
||||
@@ -93,7 +95,7 @@ public class GuiCapacitorBank extends GuiContainerBase {
|
||||
});
|
||||
inputRsButton.setTooltipKey("enderio.gui.capBank.inputRs");
|
||||
|
||||
y += 20;
|
||||
y += 18;
|
||||
outputRsButton = new RedstoneModeButton(this, -1, x, y, new IRedstoneModeControlable() {
|
||||
|
||||
@Override
|
||||
@@ -261,15 +263,15 @@ public class GuiCapacitorBank extends GuiContainerBase {
|
||||
int sx = (width - xSize) / 2;
|
||||
int sy = (height - ySize) / 2;
|
||||
|
||||
drawTexturedModalRect(sx, sy, 0, 0, this.xSize, this.ySize);
|
||||
drawTexturedModalRect(sx, sy, 0, 0, this.xSize - 21, this.ySize);
|
||||
|
||||
//armor slots
|
||||
drawTexturedModalRect(sx - 21, sy + 24, 232, 0, 24, 81);
|
||||
//drawTexturedModalRect(sx - 21, sy + 24, 232, 0, 24, 81);
|
||||
|
||||
|
||||
|
||||
int i1 = capBank.getEnergyStoredScaled(POWER_HEIGHT);
|
||||
drawTexturedModalRect(sx + POWER_X, sy + BOTTOM_POWER_Y - i1, 176, 0, POWER_WIDTH, i1);
|
||||
drawTexturedModalRect(sx + POWER_X, sy + BOTTOM_POWER_Y - i1, 176 + 21, 0, POWER_WIDTH, i1);
|
||||
|
||||
for (int i = 0; i < buttonList.size(); ++i) {
|
||||
GuiButton guibutton = (GuiButton) this.buttonList.get(i);
|
||||
@@ -315,7 +317,7 @@ public class GuiCapacitorBank extends GuiContainerBase {
|
||||
|
||||
@Override
|
||||
public int getGuiLeft() {
|
||||
return guiLeft;
|
||||
return guiLeft + 24;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -325,7 +327,12 @@ public class GuiCapacitorBank extends GuiContainerBase {
|
||||
|
||||
@Override
|
||||
public int getXSize() {
|
||||
return xSize;
|
||||
return xSize - 42;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOverlayOffsetX() {
|
||||
return 21;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -272,4 +272,11 @@ public abstract class GuiContainerBase extends GuiContainer implements ToolTipRe
|
||||
buttonList.remove(button);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOverlayOffsetX() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -20,8 +20,7 @@ public interface IGuiScreen {
|
||||
|
||||
void removeButton(GuiButton button);
|
||||
|
||||
|
||||
|
||||
int getOverlayOffsetX();
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user