From 25cf5236ea238af4f68cf00cc24f349d84aa1f7a Mon Sep 17 00:00:00 2001 From: "Aidan C. Brady" Date: Mon, 21 Jul 2014 21:33:43 -0400 Subject: [PATCH] A few fixes --- src/main/java/mekanism/common/Upgrade.java | 14 +++++++++----- .../ContainerAdvancedElectricMachine.java | 2 -- .../container/ContainerChanceMachine.java | 2 -- .../container/ContainerChemicalCrystallizer.java | 2 -- .../ContainerChemicalDissolutionChamber.java | 2 -- .../container/ContainerChemicalOxidizer.java | 2 -- .../inventory/container/ContainerDigitalMiner.java | 2 -- .../container/ContainerElectricMachine.java | 2 -- .../inventory/container/ContainerFactory.java | 2 -- .../container/ContainerMetallurgicInfuser.java | 9 --------- .../common/inventory/container/ContainerPRC.java | 2 -- .../container/ContainerUpgradeManagement.java | 4 ++-- .../common/inventory/slot/SlotMachineUpgrade.java | 4 ++-- .../java/mekanism/common/tile/TileEntityPRC.java | 4 ++-- 14 files changed, 15 insertions(+), 38 deletions(-) diff --git a/src/main/java/mekanism/common/Upgrade.java b/src/main/java/mekanism/common/Upgrade.java index 081cf591c..7a4931fca 100644 --- a/src/main/java/mekanism/common/Upgrade.java +++ b/src/main/java/mekanism/common/Upgrade.java @@ -54,14 +54,18 @@ public enum Upgrade public static Map buildMap(NBTTagCompound nbtTags) { Map upgrades = new HashMap(); - NBTTagList list = nbtTags.getTagList("upgrades", NBT.TAG_COMPOUND); - for(int tagCount = 0; tagCount < list.tagCount(); tagCount++) + if(nbtTags.hasKey("upgrades")) { - NBTTagCompound compound = (NBTTagCompound)list.getCompoundTagAt(tagCount); + NBTTagList list = nbtTags.getTagList("upgrades", NBT.TAG_COMPOUND); - Upgrade upgrade = Upgrade.values()[compound.getInteger("type")]; - upgrades.put(upgrade, compound.getInteger("amount")); + for(int tagCount = 0; tagCount < list.tagCount(); tagCount++) + { + NBTTagCompound compound = (NBTTagCompound)list.getCompoundTagAt(tagCount); + + Upgrade upgrade = Upgrade.values()[compound.getInteger("type")]; + upgrades.put(upgrade, compound.getInteger("amount")); + } } return upgrades; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerAdvancedElectricMachine.java b/src/main/java/mekanism/common/inventory/container/ContainerAdvancedElectricMachine.java index 4231f7cd9..a60b384a0 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerAdvancedElectricMachine.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerAdvancedElectricMachine.java @@ -4,9 +4,7 @@ import java.util.Map; import mekanism.api.AdvancedInput; import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; -import mekanism.common.inventory.slot.SlotMachineUpgrade; import mekanism.common.inventory.slot.SlotOutput; -import mekanism.common.item.ItemMachineUpgrade; import mekanism.common.tile.TileEntityAdvancedElectricMachine; import mekanism.common.util.ChargeUtils; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerChanceMachine.java b/src/main/java/mekanism/common/inventory/container/ContainerChanceMachine.java index 3184a0e41..4aee40228 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerChanceMachine.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerChanceMachine.java @@ -1,9 +1,7 @@ package mekanism.common.inventory.container; import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; -import mekanism.common.inventory.slot.SlotMachineUpgrade; import mekanism.common.inventory.slot.SlotOutput; -import mekanism.common.item.ItemMachineUpgrade; import mekanism.common.recipe.RecipeHandler; import mekanism.common.tile.TileEntityChanceMachine; import mekanism.common.util.ChargeUtils; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerChemicalCrystallizer.java b/src/main/java/mekanism/common/inventory/container/ContainerChemicalCrystallizer.java index 6607d00ab..fab2cfbaa 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerChemicalCrystallizer.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerChemicalCrystallizer.java @@ -2,10 +2,8 @@ package mekanism.common.inventory.container; import mekanism.api.gas.IGasItem; import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; -import mekanism.common.inventory.slot.SlotMachineUpgrade; import mekanism.common.inventory.slot.SlotOutput; import mekanism.common.inventory.slot.SlotStorageTank; -import mekanism.common.item.ItemMachineUpgrade; import mekanism.common.tile.TileEntityChemicalCrystallizer; import mekanism.common.util.ChargeUtils; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerChemicalDissolutionChamber.java b/src/main/java/mekanism/common/inventory/container/ContainerChemicalDissolutionChamber.java index d7d6db4c5..7c362ee91 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerChemicalDissolutionChamber.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerChemicalDissolutionChamber.java @@ -2,9 +2,7 @@ package mekanism.common.inventory.container; import mekanism.api.gas.IGasItem; import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; -import mekanism.common.inventory.slot.SlotMachineUpgrade; import mekanism.common.inventory.slot.SlotStorageTank; -import mekanism.common.item.ItemMachineUpgrade; import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.RecipeHandler.Recipe; import mekanism.common.tile.TileEntityChemicalDissolutionChamber; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerChemicalOxidizer.java b/src/main/java/mekanism/common/inventory/container/ContainerChemicalOxidizer.java index ccba9f249..e856a456a 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerChemicalOxidizer.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerChemicalOxidizer.java @@ -2,9 +2,7 @@ package mekanism.common.inventory.container; import mekanism.api.gas.IGasItem; import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; -import mekanism.common.inventory.slot.SlotMachineUpgrade; import mekanism.common.inventory.slot.SlotStorageTank; -import mekanism.common.item.ItemMachineUpgrade; import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.RecipeHandler.Recipe; import mekanism.common.tile.TileEntityChemicalOxidizer; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerDigitalMiner.java b/src/main/java/mekanism/common/inventory/container/ContainerDigitalMiner.java index 5d6c96e57..a2f1ecbd7 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerDigitalMiner.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerDigitalMiner.java @@ -1,8 +1,6 @@ package mekanism.common.inventory.container; import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; -import mekanism.common.inventory.slot.SlotMachineUpgrade; -import mekanism.common.item.ItemMachineUpgrade; import mekanism.common.tile.TileEntityDigitalMiner; import mekanism.common.util.ChargeUtils; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerElectricMachine.java b/src/main/java/mekanism/common/inventory/container/ContainerElectricMachine.java index 8b72812b6..4045db1d6 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerElectricMachine.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerElectricMachine.java @@ -1,9 +1,7 @@ package mekanism.common.inventory.container; import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; -import mekanism.common.inventory.slot.SlotMachineUpgrade; import mekanism.common.inventory.slot.SlotOutput; -import mekanism.common.item.ItemMachineUpgrade; import mekanism.common.recipe.RecipeHandler; import mekanism.common.tile.TileEntityElectricMachine; import mekanism.common.util.ChargeUtils; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerFactory.java b/src/main/java/mekanism/common/inventory/container/ContainerFactory.java index 5e5cc6b7a..a0709706f 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerFactory.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerFactory.java @@ -4,10 +4,8 @@ import mekanism.common.IFactory.RecipeType; import mekanism.common.Tier; import mekanism.common.Tier.FactoryTier; import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; -import mekanism.common.inventory.slot.SlotMachineUpgrade; import mekanism.common.inventory.slot.SlotOutput; import mekanism.common.item.ItemBlockMachine; -import mekanism.common.item.ItemMachineUpgrade; import mekanism.common.tile.TileEntityFactory; import mekanism.common.util.ChargeUtils; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerMetallurgicInfuser.java b/src/main/java/mekanism/common/inventory/container/ContainerMetallurgicInfuser.java index 3958df8c7..74774f4c6 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerMetallurgicInfuser.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerMetallurgicInfuser.java @@ -3,9 +3,7 @@ package mekanism.common.inventory.container; import mekanism.api.infuse.InfuseRegistry; import mekanism.api.infuse.InfusionInput; import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; -import mekanism.common.inventory.slot.SlotMachineUpgrade; import mekanism.common.inventory.slot.SlotOutput; -import mekanism.common.item.ItemMachineUpgrade; import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.RecipeHandler.Recipe; import mekanism.common.tile.TileEntityMetallurgicInfuser; @@ -81,13 +79,6 @@ public class ContainerMetallurgicInfuser extends Container return null; } } - else if(slotStack.getItem() instanceof ItemMachineUpgrade) - { - if(!mergeItemStack(slotStack, 0, 1, false)) - { - return null; - } - } else if(ChargeUtils.canBeDischarged(slotStack)) { if(!mergeItemStack(slotStack, 4, 5, false)) diff --git a/src/main/java/mekanism/common/inventory/container/ContainerPRC.java b/src/main/java/mekanism/common/inventory/container/ContainerPRC.java index cd44ecd2b..02c2e6808 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerPRC.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerPRC.java @@ -1,9 +1,7 @@ package mekanism.common.inventory.container; import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; -import mekanism.common.inventory.slot.SlotMachineUpgrade; import mekanism.common.inventory.slot.SlotOutput; -import mekanism.common.item.ItemMachineUpgrade; import mekanism.common.recipe.RecipeHandler; import mekanism.common.tile.TileEntityPRC; import mekanism.common.util.ChargeUtils; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerUpgradeManagement.java b/src/main/java/mekanism/common/inventory/container/ContainerUpgradeManagement.java index ce5dd9bc3..2a5a9322d 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerUpgradeManagement.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerUpgradeManagement.java @@ -1,8 +1,8 @@ package mekanism.common.inventory.container; +import mekanism.common.IUpgradeItem; import mekanism.common.IUpgradeTile; import mekanism.common.inventory.slot.SlotMachineUpgrade; -import mekanism.common.item.ItemMachineUpgrade; import mekanism.common.tile.TileEntityContainerBlock; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -64,7 +64,7 @@ public class ContainerUpgradeManagement extends Container ItemStack slotStack = currentSlot.getStack(); stack = slotStack.copy(); - if(slotStack.getItem() instanceof ItemMachineUpgrade) + if(slotStack.getItem() instanceof IUpgradeItem) { if(slotID != 0) { diff --git a/src/main/java/mekanism/common/inventory/slot/SlotMachineUpgrade.java b/src/main/java/mekanism/common/inventory/slot/SlotMachineUpgrade.java index a7ca6acd4..dd769b52d 100644 --- a/src/main/java/mekanism/common/inventory/slot/SlotMachineUpgrade.java +++ b/src/main/java/mekanism/common/inventory/slot/SlotMachineUpgrade.java @@ -1,6 +1,6 @@ package mekanism.common.inventory.slot; -import mekanism.common.item.ItemMachineUpgrade; +import mekanism.common.IUpgradeItem; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; @@ -15,6 +15,6 @@ public class SlotMachineUpgrade extends Slot @Override public boolean isItemValid(ItemStack itemstack) { - return itemstack.getItem() instanceof ItemMachineUpgrade; + return itemstack.getItem() instanceof IUpgradeItem; } } diff --git a/src/main/java/mekanism/common/tile/TileEntityPRC.java b/src/main/java/mekanism/common/tile/TileEntityPRC.java index 5f2c5db08..6c5e1cda5 100644 --- a/src/main/java/mekanism/common/tile/TileEntityPRC.java +++ b/src/main/java/mekanism/common/tile/TileEntityPRC.java @@ -15,10 +15,10 @@ import mekanism.api.gas.GasStack; import mekanism.api.gas.GasTank; import mekanism.api.gas.IGasHandler; import mekanism.api.gas.ITubeConnection; +import mekanism.common.IUpgradeItem; import mekanism.common.Mekanism; import mekanism.common.SideData; import mekanism.common.block.BlockMachine.MachineType; -import mekanism.common.item.ItemMachineUpgrade; import mekanism.common.recipe.RecipeHandler; import mekanism.common.tile.component.TileComponentEjector; import mekanism.common.tile.component.TileComponentUpgrade; @@ -140,7 +140,7 @@ public class TileEntityPRC extends TileEntityBasicMachine implements IFluidHandl } else if(slotID == 3) { - return itemstack.getItem() instanceof ItemMachineUpgrade; + return itemstack.getItem() instanceof IUpgradeItem; } return false;