A few fixes

This commit is contained in:
Aidan C. Brady 2014-07-21 21:33:43 -04:00
parent 076c5f7377
commit 25cf5236ea
14 changed files with 15 additions and 38 deletions

View file

@ -54,14 +54,18 @@ public enum Upgrade
public static Map<Upgrade, Integer> buildMap(NBTTagCompound nbtTags) public static Map<Upgrade, Integer> buildMap(NBTTagCompound nbtTags)
{ {
Map<Upgrade, Integer> upgrades = new HashMap<Upgrade, Integer>(); Map<Upgrade, Integer> upgrades = new HashMap<Upgrade, Integer>();
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")]; for(int tagCount = 0; tagCount < list.tagCount(); tagCount++)
upgrades.put(upgrade, compound.getInteger("amount")); {
NBTTagCompound compound = (NBTTagCompound)list.getCompoundTagAt(tagCount);
Upgrade upgrade = Upgrade.values()[compound.getInteger("type")];
upgrades.put(upgrade, compound.getInteger("amount"));
}
} }
return upgrades; return upgrades;

View file

@ -4,9 +4,7 @@ import java.util.Map;
import mekanism.api.AdvancedInput; import mekanism.api.AdvancedInput;
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
import mekanism.common.inventory.slot.SlotMachineUpgrade;
import mekanism.common.inventory.slot.SlotOutput; import mekanism.common.inventory.slot.SlotOutput;
import mekanism.common.item.ItemMachineUpgrade;
import mekanism.common.tile.TileEntityAdvancedElectricMachine; import mekanism.common.tile.TileEntityAdvancedElectricMachine;
import mekanism.common.util.ChargeUtils; import mekanism.common.util.ChargeUtils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;

View file

@ -1,9 +1,7 @@
package mekanism.common.inventory.container; package mekanism.common.inventory.container;
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
import mekanism.common.inventory.slot.SlotMachineUpgrade;
import mekanism.common.inventory.slot.SlotOutput; import mekanism.common.inventory.slot.SlotOutput;
import mekanism.common.item.ItemMachineUpgrade;
import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.RecipeHandler;
import mekanism.common.tile.TileEntityChanceMachine; import mekanism.common.tile.TileEntityChanceMachine;
import mekanism.common.util.ChargeUtils; import mekanism.common.util.ChargeUtils;

View file

@ -2,10 +2,8 @@ package mekanism.common.inventory.container;
import mekanism.api.gas.IGasItem; import mekanism.api.gas.IGasItem;
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
import mekanism.common.inventory.slot.SlotMachineUpgrade;
import mekanism.common.inventory.slot.SlotOutput; import mekanism.common.inventory.slot.SlotOutput;
import mekanism.common.inventory.slot.SlotStorageTank; import mekanism.common.inventory.slot.SlotStorageTank;
import mekanism.common.item.ItemMachineUpgrade;
import mekanism.common.tile.TileEntityChemicalCrystallizer; import mekanism.common.tile.TileEntityChemicalCrystallizer;
import mekanism.common.util.ChargeUtils; import mekanism.common.util.ChargeUtils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;

View file

@ -2,9 +2,7 @@ package mekanism.common.inventory.container;
import mekanism.api.gas.IGasItem; import mekanism.api.gas.IGasItem;
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
import mekanism.common.inventory.slot.SlotMachineUpgrade;
import mekanism.common.inventory.slot.SlotStorageTank; import mekanism.common.inventory.slot.SlotStorageTank;
import mekanism.common.item.ItemMachineUpgrade;
import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.RecipeHandler;
import mekanism.common.recipe.RecipeHandler.Recipe; import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.tile.TileEntityChemicalDissolutionChamber; import mekanism.common.tile.TileEntityChemicalDissolutionChamber;

View file

@ -2,9 +2,7 @@ package mekanism.common.inventory.container;
import mekanism.api.gas.IGasItem; import mekanism.api.gas.IGasItem;
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
import mekanism.common.inventory.slot.SlotMachineUpgrade;
import mekanism.common.inventory.slot.SlotStorageTank; import mekanism.common.inventory.slot.SlotStorageTank;
import mekanism.common.item.ItemMachineUpgrade;
import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.RecipeHandler;
import mekanism.common.recipe.RecipeHandler.Recipe; import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.tile.TileEntityChemicalOxidizer; import mekanism.common.tile.TileEntityChemicalOxidizer;

View file

@ -1,8 +1,6 @@
package mekanism.common.inventory.container; package mekanism.common.inventory.container;
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; 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.tile.TileEntityDigitalMiner;
import mekanism.common.util.ChargeUtils; import mekanism.common.util.ChargeUtils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;

View file

@ -1,9 +1,7 @@
package mekanism.common.inventory.container; package mekanism.common.inventory.container;
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
import mekanism.common.inventory.slot.SlotMachineUpgrade;
import mekanism.common.inventory.slot.SlotOutput; import mekanism.common.inventory.slot.SlotOutput;
import mekanism.common.item.ItemMachineUpgrade;
import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.RecipeHandler;
import mekanism.common.tile.TileEntityElectricMachine; import mekanism.common.tile.TileEntityElectricMachine;
import mekanism.common.util.ChargeUtils; import mekanism.common.util.ChargeUtils;

View file

@ -4,10 +4,8 @@ import mekanism.common.IFactory.RecipeType;
import mekanism.common.Tier; import mekanism.common.Tier;
import mekanism.common.Tier.FactoryTier; import mekanism.common.Tier.FactoryTier;
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
import mekanism.common.inventory.slot.SlotMachineUpgrade;
import mekanism.common.inventory.slot.SlotOutput; import mekanism.common.inventory.slot.SlotOutput;
import mekanism.common.item.ItemBlockMachine; import mekanism.common.item.ItemBlockMachine;
import mekanism.common.item.ItemMachineUpgrade;
import mekanism.common.tile.TileEntityFactory; import mekanism.common.tile.TileEntityFactory;
import mekanism.common.util.ChargeUtils; import mekanism.common.util.ChargeUtils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;

View file

@ -3,9 +3,7 @@ package mekanism.common.inventory.container;
import mekanism.api.infuse.InfuseRegistry; import mekanism.api.infuse.InfuseRegistry;
import mekanism.api.infuse.InfusionInput; import mekanism.api.infuse.InfusionInput;
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
import mekanism.common.inventory.slot.SlotMachineUpgrade;
import mekanism.common.inventory.slot.SlotOutput; import mekanism.common.inventory.slot.SlotOutput;
import mekanism.common.item.ItemMachineUpgrade;
import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.RecipeHandler;
import mekanism.common.recipe.RecipeHandler.Recipe; import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.tile.TileEntityMetallurgicInfuser; import mekanism.common.tile.TileEntityMetallurgicInfuser;
@ -81,13 +79,6 @@ public class ContainerMetallurgicInfuser extends Container
return null; return null;
} }
} }
else if(slotStack.getItem() instanceof ItemMachineUpgrade)
{
if(!mergeItemStack(slotStack, 0, 1, false))
{
return null;
}
}
else if(ChargeUtils.canBeDischarged(slotStack)) else if(ChargeUtils.canBeDischarged(slotStack))
{ {
if(!mergeItemStack(slotStack, 4, 5, false)) if(!mergeItemStack(slotStack, 4, 5, false))

View file

@ -1,9 +1,7 @@
package mekanism.common.inventory.container; package mekanism.common.inventory.container;
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
import mekanism.common.inventory.slot.SlotMachineUpgrade;
import mekanism.common.inventory.slot.SlotOutput; import mekanism.common.inventory.slot.SlotOutput;
import mekanism.common.item.ItemMachineUpgrade;
import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.RecipeHandler;
import mekanism.common.tile.TileEntityPRC; import mekanism.common.tile.TileEntityPRC;
import mekanism.common.util.ChargeUtils; import mekanism.common.util.ChargeUtils;

View file

@ -1,8 +1,8 @@
package mekanism.common.inventory.container; package mekanism.common.inventory.container;
import mekanism.common.IUpgradeItem;
import mekanism.common.IUpgradeTile; import mekanism.common.IUpgradeTile;
import mekanism.common.inventory.slot.SlotMachineUpgrade; import mekanism.common.inventory.slot.SlotMachineUpgrade;
import mekanism.common.item.ItemMachineUpgrade;
import mekanism.common.tile.TileEntityContainerBlock; import mekanism.common.tile.TileEntityContainerBlock;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
@ -64,7 +64,7 @@ public class ContainerUpgradeManagement extends Container
ItemStack slotStack = currentSlot.getStack(); ItemStack slotStack = currentSlot.getStack();
stack = slotStack.copy(); stack = slotStack.copy();
if(slotStack.getItem() instanceof ItemMachineUpgrade) if(slotStack.getItem() instanceof IUpgradeItem)
{ {
if(slotID != 0) if(slotID != 0)
{ {

View file

@ -1,6 +1,6 @@
package mekanism.common.inventory.slot; package mekanism.common.inventory.slot;
import mekanism.common.item.ItemMachineUpgrade; import mekanism.common.IUpgradeItem;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -15,6 +15,6 @@ public class SlotMachineUpgrade extends Slot
@Override @Override
public boolean isItemValid(ItemStack itemstack) public boolean isItemValid(ItemStack itemstack)
{ {
return itemstack.getItem() instanceof ItemMachineUpgrade; return itemstack.getItem() instanceof IUpgradeItem;
} }
} }

View file

@ -15,10 +15,10 @@ import mekanism.api.gas.GasStack;
import mekanism.api.gas.GasTank; import mekanism.api.gas.GasTank;
import mekanism.api.gas.IGasHandler; import mekanism.api.gas.IGasHandler;
import mekanism.api.gas.ITubeConnection; import mekanism.api.gas.ITubeConnection;
import mekanism.common.IUpgradeItem;
import mekanism.common.Mekanism; import mekanism.common.Mekanism;
import mekanism.common.SideData; import mekanism.common.SideData;
import mekanism.common.block.BlockMachine.MachineType; import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.item.ItemMachineUpgrade;
import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.RecipeHandler;
import mekanism.common.tile.component.TileComponentEjector; import mekanism.common.tile.component.TileComponentEjector;
import mekanism.common.tile.component.TileComponentUpgrade; import mekanism.common.tile.component.TileComponentUpgrade;
@ -140,7 +140,7 @@ public class TileEntityPRC extends TileEntityBasicMachine implements IFluidHandl
} }
else if(slotID == 3) else if(slotID == 3)
{ {
return itemstack.getItem() instanceof ItemMachineUpgrade; return itemstack.getItem() instanceof IUpgradeItem;
} }
return false; return false;