mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-25 22:44:34 +00:00
Added armor slots to capacitor bank.
This commit is contained in:
1 parent
9783e2148a
commit
5f2e72bde5
5 files changed
+48
-5
No files matched your search
@@ -17,6 +17,12 @@ public abstract class AbstractMachineContainer extends Container {
|
||||
|
||||
if(te.getSlotDefinition().getNumUpgradeSlots() == 1) {
|
||||
addSlotToContainer(new Slot(te, te.getSlotDefinition().getMinUpgradeSlot(), 12, 60) {
|
||||
|
||||
@Override
|
||||
public int getSlotStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack itemStack) {
|
||||
return tileEntity.isItemValidForSlot(tileEntity.getSlotDefinition().getMinUpgradeSlot(), itemStack);
|
||||
|
||||
@@ -122,7 +122,7 @@ public class BlockCapacitorBank extends BlockEio implements IGuiHandler {
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TileCapacitorBank) {
|
||||
return new ContainerCapacitorBank(player.inventory, ((TileCapacitorBank) te).getController());
|
||||
return new ContainerCapacitorBank(player, player.inventory, ((TileCapacitorBank) te).getController());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -131,7 +131,7 @@ public class BlockCapacitorBank extends BlockEio implements IGuiHandler {
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TileCapacitorBank) {
|
||||
return new GuiCapacitorBank(player.inventory, ((TileCapacitorBank) te).getController());
|
||||
return new GuiCapacitorBank(player, player.inventory, ((TileCapacitorBank) te).getController());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
package crazypants.enderio.machine.power;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ContainerCapacitorBank extends Container {
|
||||
|
||||
private final TileCapacitorBank tileEntity;
|
||||
|
||||
public ContainerCapacitorBank(InventoryPlayer playerInv, TileCapacitorBank te) {
|
||||
public ContainerCapacitorBank(final Entity player, InventoryPlayer playerInv, TileCapacitorBank te) {
|
||||
|
||||
tileEntity = te;
|
||||
|
||||
@@ -53,6 +58,32 @@ public class ContainerCapacitorBank extends Container {
|
||||
addSlotToContainer(new Slot(playerInv, i, 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) {
|
||||
|
||||
@Override
|
||||
public int getSlotStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
if (par1ItemStack == null) {
|
||||
return false;
|
||||
}
|
||||
return par1ItemStack.getItem().isValidArmor(par1ItemStack, k, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getBackgroundIconIndex() {
|
||||
return ItemArmor.func_94602_b(k);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -60,8 +61,8 @@ public class GuiCapacitorBank extends GuiContainerBase {
|
||||
private GuiOverlayIoConfig configOverlay;
|
||||
private IconButtonEIO configB;
|
||||
|
||||
public GuiCapacitorBank(InventoryPlayer playerInv, TileCapacitorBank te) {
|
||||
super(new ContainerCapacitorBank(playerInv, te));
|
||||
public GuiCapacitorBank(Entity player, InventoryPlayer playerInv, TileCapacitorBank te) {
|
||||
super(new ContainerCapacitorBank(player, playerInv, te));
|
||||
this.capBank = te;
|
||||
|
||||
addToolTip(new GuiToolTip(new Rectangle(POWER_X, POWER_Y, POWER_WIDTH, POWER_HEIGHT), "") {
|
||||
@@ -262,6 +263,11 @@ public class GuiCapacitorBank extends GuiContainerBase {
|
||||
|
||||
drawTexturedModalRect(sx, sy, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
//armor slots
|
||||
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);
|
||||
|
||||
|
||||
Reference in new issue
Block a user