diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerDrill.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerDrill.java index 5d5281aa7..b8a3d30dc 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerDrill.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerDrill.java @@ -62,6 +62,14 @@ public class ContainerDrill extends Container{ super.onContainerClosed(player); } + @Override + public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer player){ + //par3 appears to be the type of clicking + //par3 == 2 appears to be one of the number keys being hit + if(par3 == 2 && par2 == inventory.currentItem) return null; + else return super.slotClick(par1, par2, par3, player); + } + @Override public ItemStack transferStackInSlot(EntityPlayer player, int slot){ final int inventoryStart = 5; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnergizer.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnergizer.java index e58c188b3..7b88403a5 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnergizer.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnergizer.java @@ -1,6 +1,8 @@ package ellpeck.actuallyadditions.inventory; import cofh.api.energy.IEnergyContainerItem; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.inventory.slot.SlotOutput; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityEnergizer; @@ -9,15 +11,18 @@ 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; @InventoryContainer public class ContainerEnergizer extends Container{ private TileEntityEnergizer energizer; - public ContainerEnergizer(InventoryPlayer inventory, TileEntityBase tile){ + public ContainerEnergizer(EntityPlayer player, TileEntityBase tile){ this.energizer = (TileEntityEnergizer)tile; + InventoryPlayer inventory = player.inventory; this.addSlotToContainer(new Slot(this.energizer, 0, 76, 73)); this.addSlotToContainer(new SlotOutput(this.energizer, 1, 76, 42)); @@ -30,6 +35,25 @@ public class ContainerEnergizer extends Container{ for (int i = 0; i < 9; i++){ this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155)); } + final EntityPlayer finalPlayer = player; + for(int i = 0; i < 4; ++i){ + final int finalI = i; + this.addSlotToContainer(new Slot(inventory, inventory.getSizeInventory()-1-i, 102, 19+i*18){ + @Override + public int getSlotStackLimit(){ + return 1; + } + @Override + public boolean isItemValid(ItemStack stack){ + return stack != null && stack.getItem().isValidArmor(stack, finalI, finalPlayer); + } + @Override + @SideOnly(Side.CLIENT) + public IIcon getBackgroundIconIndex(){ + return ItemArmor.func_94602_b(finalI); + } + }); + } } @Override @@ -37,6 +61,7 @@ public class ContainerEnergizer extends Container{ return this.energizer.isUseableByPlayer(player); } + //TODO Armor Shift-Clicking @Override public ItemStack transferStackInSlot(EntityPlayer player, int slot){ final int inventoryStart = 2; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnervator.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnervator.java index c66bb6d9f..529d8c2df 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnervator.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnervator.java @@ -1,6 +1,8 @@ package ellpeck.actuallyadditions.inventory; import cofh.api.energy.IEnergyContainerItem; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.inventory.slot.SlotOutput; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityEnervator; @@ -9,15 +11,18 @@ 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; @InventoryContainer public class ContainerEnervator extends Container{ private TileEntityEnervator enervator; - public ContainerEnervator(InventoryPlayer inventory, TileEntityBase tile){ + public ContainerEnervator(EntityPlayer player, TileEntityBase tile){ this.enervator = (TileEntityEnervator)tile; + InventoryPlayer inventory = player.inventory; this.addSlotToContainer(new Slot(this.enervator, 0, 76, 73)); this.addSlotToContainer(new SlotOutput(this.enervator, 1, 76, 42)); @@ -30,6 +35,25 @@ public class ContainerEnervator extends Container{ for (int i = 0; i < 9; i++){ this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155)); } + final EntityPlayer finalPlayer = player; + for(int i = 0; i < 4; ++i){ + final int finalI = i; + this.addSlotToContainer(new Slot(inventory, inventory.getSizeInventory()-1-i, 102, 19+i*18){ + @Override + public int getSlotStackLimit(){ + return 1; + } + @Override + public boolean isItemValid(ItemStack stack){ + return stack != null && stack.getItem().isValidArmor(stack, finalI, finalPlayer); + } + @Override + @SideOnly(Side.CLIENT) + public IIcon getBackgroundIconIndex(){ + return ItemArmor.func_94602_b(finalI); + } + }); + } } @Override @@ -37,6 +61,7 @@ public class ContainerEnervator extends Container{ return this.enervator.isUseableByPlayer(player); } + //TODO Armor Shift-Clicking @Override public ItemStack transferStackInSlot(EntityPlayer player, int slot){ final int inventoryStart = 2; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java b/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java index 5319aee9f..a174cb044 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java @@ -57,9 +57,9 @@ public class GuiHandler implements IGuiHandler{ case DRILL_ID: return new ContainerDrill(entityPlayer.inventory); case ENERGIZER_ID: - return new ContainerEnergizer(entityPlayer.inventory, tile); + return new ContainerEnergizer(entityPlayer, tile); case ENERVATOR_ID: - return new ContainerEnervator(entityPlayer.inventory, tile); + return new ContainerEnervator(entityPlayer, tile); default: return null; } @@ -111,9 +111,9 @@ public class GuiHandler implements IGuiHandler{ case DRILL_ID: return new GuiDrill(entityPlayer.inventory); case ENERGIZER_ID: - return new GuiEnergizer(entityPlayer.inventory, tile); + return new GuiEnergizer(entityPlayer, tile); case ENERVATOR_ID: - return new GuiEnervator(entityPlayer.inventory, tile); + return new GuiEnervator(entityPlayer, tile); default: return null; } diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnergizer.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnergizer.java index 9fd9976eb..65ed62640 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnergizer.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnergizer.java @@ -7,7 +7,7 @@ import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityEnergizer; import ellpeck.actuallyadditions.util.AssetUtil; import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; @@ -20,7 +20,7 @@ public class GuiEnergizer extends GuiContainer{ private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiEnergizer"); - public GuiEnergizer(InventoryPlayer inventory, TileEntityBase tile){ + public GuiEnergizer(EntityPlayer inventory, TileEntityBase tile){ super(new ContainerEnergizer(inventory, tile)); this.energizer = (TileEntityEnergizer)tile; this.xSize = 176; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnervator.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnervator.java index e6f367f34..4fdf21482 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnervator.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiEnervator.java @@ -7,7 +7,7 @@ import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityEnervator; import ellpeck.actuallyadditions.util.AssetUtil; import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; @@ -20,7 +20,7 @@ public class GuiEnervator extends GuiContainer{ private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiEnergizer"); - public GuiEnervator(InventoryPlayer inventory, TileEntityBase tile){ + public GuiEnervator(EntityPlayer inventory, TileEntityBase tile){ super(new ContainerEnervator(inventory, tile)); this.enervator = (TileEntityEnervator)tile; this.xSize = 176; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/slot/SlotImmovable.java b/src/main/java/ellpeck/actuallyadditions/inventory/slot/SlotImmovable.java index 5a84544b4..5d0016271 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/slot/SlotImmovable.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/slot/SlotImmovable.java @@ -11,6 +11,16 @@ public class SlotImmovable extends Slot{ super(inventory, id, x, y); } + @Override + public void putStack(ItemStack stack){ + + } + + @Override + public ItemStack decrStackSize(int i){ + return null; + } + @Override public boolean canTakeStack(EntityPlayer player){ return false; @@ -20,5 +30,4 @@ public class SlotImmovable extends Slot{ public boolean isItemValid(ItemStack stack){ return false; } - } diff --git a/src/main/resources/assets/actuallyadditions/textures/gui/guiEnergizer.png b/src/main/resources/assets/actuallyadditions/textures/gui/guiEnergizer.png index 621f107cc..20e303172 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/gui/guiEnergizer.png and b/src/main/resources/assets/actuallyadditions/textures/gui/guiEnergizer.png differ