From fb12bfab9e65c66e57588c53b5abbf72b9565159 Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Thu, 25 Feb 2016 14:21:31 +0000 Subject: [PATCH] Changed upgrade slots to SlotUpgrade --- src/main/java/techreborn/api/SlotUpgrade.java | 21 +++++++++++++++++++ .../container/ContainerAlloySmelter.java | 9 ++++---- .../container/ContainerAssemblingMachine.java | 9 ++++---- .../client/container/ContainerCentrifuge.java | 9 ++++---- .../container/ContainerChemicalReactor.java | 9 ++++---- .../client/container/ContainerCompressor.java | 9 ++++---- .../container/ContainerElectricFurnace.java | 9 ++++---- .../client/container/ContainerExtractor.java | 9 ++++---- .../client/container/ContainerGrinder.java | 9 ++++---- 9 files changed, 61 insertions(+), 32 deletions(-) create mode 100644 src/main/java/techreborn/api/SlotUpgrade.java diff --git a/src/main/java/techreborn/api/SlotUpgrade.java b/src/main/java/techreborn/api/SlotUpgrade.java new file mode 100644 index 000000000..6789f1a88 --- /dev/null +++ b/src/main/java/techreborn/api/SlotUpgrade.java @@ -0,0 +1,21 @@ +package techreborn.api; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import techreborn.api.upgrade.IMachineUpgrade; + +public class SlotUpgrade extends Slot{ + + public SlotUpgrade(IInventory inventoryIn, int index, int xPosition, int yPosition) { + super(inventoryIn, index, xPosition, yPosition); + } + + @Override + public boolean isItemValid(ItemStack stack) { + if(stack.getItem() instanceof IMachineUpgrade){ + return true; + } + else return false; + } +} diff --git a/src/main/java/techreborn/client/container/ContainerAlloySmelter.java b/src/main/java/techreborn/client/container/ContainerAlloySmelter.java index b1a919755..1556e9473 100644 --- a/src/main/java/techreborn/client/container/ContainerAlloySmelter.java +++ b/src/main/java/techreborn/client/container/ContainerAlloySmelter.java @@ -3,6 +3,7 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; import reborncore.client.gui.SlotOutput; +import techreborn.api.SlotUpgrade; import techreborn.tiles.TileAlloySmelter; public class ContainerAlloySmelter extends ContainerCrafting { @@ -32,10 +33,10 @@ public class ContainerAlloySmelter extends ContainerCrafting { // battery this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 3, 56, 53)); // upgrades - this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 4, 152, 8)); - this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 5, 152, 26)); - this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 6, 152, 44)); - this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 7, 152, 62)); + this.addSlotToContainer(new SlotUpgrade(tileAlloysmelter.inventory, 4, 152, 8)); + this.addSlotToContainer(new SlotUpgrade(tileAlloysmelter.inventory, 5, 152, 26)); + this.addSlotToContainer(new SlotUpgrade(tileAlloysmelter.inventory, 6, 152, 44)); + this.addSlotToContainer(new SlotUpgrade(tileAlloysmelter.inventory, 7, 152, 62)); int i; diff --git a/src/main/java/techreborn/client/container/ContainerAssemblingMachine.java b/src/main/java/techreborn/client/container/ContainerAssemblingMachine.java index 8468be08e..670c9dc24 100644 --- a/src/main/java/techreborn/client/container/ContainerAssemblingMachine.java +++ b/src/main/java/techreborn/client/container/ContainerAssemblingMachine.java @@ -3,6 +3,7 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; import reborncore.client.gui.SlotOutput; +import techreborn.api.SlotUpgrade; import techreborn.tiles.TileAssemblingMachine; public class ContainerAssemblingMachine extends ContainerCrafting { @@ -32,10 +33,10 @@ public class ContainerAssemblingMachine extends ContainerCrafting { // power this.addSlotToContainer(new Slot(tileAssemblingMachine.inventory, 3, 56, 53)); // upgrades - this.addSlotToContainer(new Slot(tileAssemblingMachine.inventory, 4, 152, 8)); - this.addSlotToContainer(new Slot(tileAssemblingMachine.inventory, 5, 152, 26)); - this.addSlotToContainer(new Slot(tileAssemblingMachine.inventory, 6, 152, 44)); - this.addSlotToContainer(new Slot(tileAssemblingMachine.inventory, 7, 152, 62)); + this.addSlotToContainer(new SlotUpgrade(tileAssemblingMachine.inventory, 4, 152, 8)); + this.addSlotToContainer(new SlotUpgrade(tileAssemblingMachine.inventory, 5, 152, 26)); + this.addSlotToContainer(new SlotUpgrade(tileAssemblingMachine.inventory, 6, 152, 44)); + this.addSlotToContainer(new SlotUpgrade(tileAssemblingMachine.inventory, 7, 152, 62)); int i; diff --git a/src/main/java/techreborn/client/container/ContainerCentrifuge.java b/src/main/java/techreborn/client/container/ContainerCentrifuge.java index dac27e416..589b71b25 100644 --- a/src/main/java/techreborn/client/container/ContainerCentrifuge.java +++ b/src/main/java/techreborn/client/container/ContainerCentrifuge.java @@ -3,6 +3,7 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; import reborncore.client.gui.SlotOutput; +import techreborn.api.SlotUpgrade; import techreborn.tiles.TileCentrifuge; public class ContainerCentrifuge extends ContainerCrafting { @@ -34,10 +35,10 @@ public class ContainerCentrifuge extends ContainerCrafting { // battery this.addSlotToContainer(new Slot(tileCentrifuge.inventory, 6, 8, 51)); // upgrades - this.addSlotToContainer(new Slot(tileCentrifuge.inventory, 7, 152, 8)); - this.addSlotToContainer(new Slot(tileCentrifuge.inventory, 8, 152, 26)); - this.addSlotToContainer(new Slot(tileCentrifuge.inventory, 9, 152, 44)); - this.addSlotToContainer(new Slot(tileCentrifuge.inventory, 10, 152, 62)); + this.addSlotToContainer(new SlotUpgrade(tileCentrifuge.inventory, 7, 152, 8)); + this.addSlotToContainer(new SlotUpgrade(tileCentrifuge.inventory, 8, 152, 26)); + this.addSlotToContainer(new SlotUpgrade(tileCentrifuge.inventory, 9, 152, 44)); + this.addSlotToContainer(new SlotUpgrade(tileCentrifuge.inventory, 10, 152, 62)); int i; diff --git a/src/main/java/techreborn/client/container/ContainerChemicalReactor.java b/src/main/java/techreborn/client/container/ContainerChemicalReactor.java index 66fbfa53b..e61e44ded 100644 --- a/src/main/java/techreborn/client/container/ContainerChemicalReactor.java +++ b/src/main/java/techreborn/client/container/ContainerChemicalReactor.java @@ -3,6 +3,7 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; import reborncore.client.gui.SlotOutput; +import techreborn.api.SlotUpgrade; import techreborn.tiles.TileChemicalReactor; public class ContainerChemicalReactor extends ContainerCrafting { @@ -32,10 +33,10 @@ public class ContainerChemicalReactor extends ContainerCrafting { // battery this.addSlotToContainer(new Slot(tilechemicalReactor.inventory, 3, 8, 51)); // upgrades - this.addSlotToContainer(new Slot(tilechemicalReactor.inventory, 4, 152, 8)); - this.addSlotToContainer(new Slot(tilechemicalReactor.inventory, 5, 152, 26)); - this.addSlotToContainer(new Slot(tilechemicalReactor.inventory, 6, 152, 44)); - this.addSlotToContainer(new Slot(tilechemicalReactor.inventory, 7, 152, 62)); + this.addSlotToContainer(new SlotUpgrade(tilechemicalReactor.inventory, 4, 152, 8)); + this.addSlotToContainer(new SlotUpgrade(tilechemicalReactor.inventory, 5, 152, 26)); + this.addSlotToContainer(new SlotUpgrade(tilechemicalReactor.inventory, 6, 152, 44)); + this.addSlotToContainer(new SlotUpgrade(tilechemicalReactor.inventory, 7, 152, 62)); int i; diff --git a/src/main/java/techreborn/client/container/ContainerCompressor.java b/src/main/java/techreborn/client/container/ContainerCompressor.java index 91fdab2b7..339382197 100644 --- a/src/main/java/techreborn/client/container/ContainerCompressor.java +++ b/src/main/java/techreborn/client/container/ContainerCompressor.java @@ -5,6 +5,7 @@ import net.minecraft.inventory.Slot; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import reborncore.client.gui.SlotOutput; +import techreborn.api.SlotUpgrade; import techreborn.tiles.teir1.TileCompressor; public class ContainerCompressor extends ContainerCrafting { @@ -26,10 +27,10 @@ public class ContainerCompressor extends ContainerCrafting { // upgrades - this.addSlotToContainer(new Slot(tileGrinder.inventory, 2, 152, 8)); - this.addSlotToContainer(new Slot(tileGrinder.inventory, 3, 152, 26)); - this.addSlotToContainer(new Slot(tileGrinder.inventory, 4, 152, 44)); - this.addSlotToContainer(new Slot(tileGrinder.inventory, 5, 152, 62)); + this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 2, 152, 8)); + this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 3, 152, 26)); + this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 4, 152, 44)); + this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 5, 152, 62)); int i; diff --git a/src/main/java/techreborn/client/container/ContainerElectricFurnace.java b/src/main/java/techreborn/client/container/ContainerElectricFurnace.java index 3b248764c..5508b8d33 100644 --- a/src/main/java/techreborn/client/container/ContainerElectricFurnace.java +++ b/src/main/java/techreborn/client/container/ContainerElectricFurnace.java @@ -6,6 +6,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import reborncore.client.gui.SlotOutput; import reborncore.common.container.RebornContainer; +import techreborn.api.SlotUpgrade; import techreborn.tiles.teir1.TileElectricFurnace; public class ContainerElectricFurnace extends RebornContainer { @@ -27,10 +28,10 @@ public class ContainerElectricFurnace extends RebornContainer { // upgrades - this.addSlotToContainer(new Slot(tileGrinder.inventory, 2, 152, 8)); - this.addSlotToContainer(new Slot(tileGrinder.inventory, 3, 152, 26)); - this.addSlotToContainer(new Slot(tileGrinder.inventory, 4, 152, 44)); - this.addSlotToContainer(new Slot(tileGrinder.inventory, 5, 152, 62)); + this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 2, 152, 8)); + this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 3, 152, 26)); + this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 4, 152, 44)); + this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 5, 152, 62)); int i; diff --git a/src/main/java/techreborn/client/container/ContainerExtractor.java b/src/main/java/techreborn/client/container/ContainerExtractor.java index 07146562b..c0ceb6f68 100644 --- a/src/main/java/techreborn/client/container/ContainerExtractor.java +++ b/src/main/java/techreborn/client/container/ContainerExtractor.java @@ -5,6 +5,7 @@ import net.minecraft.inventory.Slot; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import reborncore.client.gui.SlotOutput; +import techreborn.api.SlotUpgrade; import techreborn.tiles.teir1.TileExtractor; public class ContainerExtractor extends ContainerCrafting { @@ -26,10 +27,10 @@ public class ContainerExtractor extends ContainerCrafting { // upgrades - this.addSlotToContainer(new Slot(tileGrinder.inventory, 2, 152, 8)); - this.addSlotToContainer(new Slot(tileGrinder.inventory, 3, 152, 26)); - this.addSlotToContainer(new Slot(tileGrinder.inventory, 4, 152, 44)); - this.addSlotToContainer(new Slot(tileGrinder.inventory, 5, 152, 62)); + this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 2, 152, 8)); + this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 3, 152, 26)); + this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 4, 152, 44)); + this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 5, 152, 62)); int i; diff --git a/src/main/java/techreborn/client/container/ContainerGrinder.java b/src/main/java/techreborn/client/container/ContainerGrinder.java index 6166862a2..9085a37ce 100644 --- a/src/main/java/techreborn/client/container/ContainerGrinder.java +++ b/src/main/java/techreborn/client/container/ContainerGrinder.java @@ -5,6 +5,7 @@ import net.minecraft.inventory.Slot; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import reborncore.client.gui.SlotOutput; +import techreborn.api.SlotUpgrade; import techreborn.tiles.teir1.TileGrinder; public class ContainerGrinder extends ContainerCrafting { @@ -26,10 +27,10 @@ public class ContainerGrinder extends ContainerCrafting { // upgrades - this.addSlotToContainer(new Slot(tileGrinder.inventory, 2, 152, 8)); - this.addSlotToContainer(new Slot(tileGrinder.inventory, 3, 152, 26)); - this.addSlotToContainer(new Slot(tileGrinder.inventory, 4, 152, 44)); - this.addSlotToContainer(new Slot(tileGrinder.inventory, 5, 152, 62)); + this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 2, 152, 8)); + this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 3, 152, 26)); + this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 4, 152, 44)); + this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 5, 152, 62)); int i;