From 4c50c442d1746308b932aed7dd7679bf9e7806f5 Mon Sep 17 00:00:00 2001 From: Aidan Brady Date: Wed, 31 Jul 2013 21:20:12 -0400 Subject: [PATCH] Better BC item integration, javadocs, cleanup --- common/mekanism/common/ChargeUtils.java | 48 ++++++++++++++++ .../ContainerAdvancedElectricMachine.java | 2 +- .../common/ContainerElectricChest.java | 2 +- .../common/ContainerElectricMachine.java | 2 +- .../common/ContainerElectricPump.java | 2 +- .../mekanism/common/ContainerEnergyCube.java | 2 +- common/mekanism/common/ContainerFactory.java | 2 +- .../common/ContainerMetallurgicInfuser.java | 2 +- .../mekanism/common/ContainerTeleporter.java | 2 +- common/mekanism/common/MekanismUtils.java | 57 ++++++++----------- common/mekanism/common/SlotEnergy.java | 4 +- .../TileEntityAdvancedElectricMachine.java | 4 +- .../common/TileEntityElectricChest.java | 4 +- .../common/TileEntityElectricMachine.java | 4 +- .../common/TileEntityElectricPump.java | 4 +- .../mekanism/common/TileEntityEnergyCube.java | 8 +-- common/mekanism/common/TileEntityFactory.java | 4 +- .../common/TileEntityMetallurgicInfuser.java | 4 +- .../mekanism/common/TileEntityTeleporter.java | 4 +- .../common/ContainerBioGenerator.java | 6 +- .../ContainerElectrolyticSeparator.java | 4 +- .../common/ContainerHeatGenerator.java | 6 +- .../common/ContainerHydrogenGenerator.java | 6 +- .../common/ContainerSolarGenerator.java | 4 +- .../common/ContainerWindTurbine.java | 6 +- .../common/TileEntityBioGenerator.java | 5 +- .../TileEntityElectrolyticSeparator.java | 4 +- .../common/TileEntityHeatGenerator.java | 4 +- .../common/TileEntityHydrogenGenerator.java | 4 +- .../common/TileEntitySolarGenerator.java | 4 +- 30 files changed, 122 insertions(+), 92 deletions(-) diff --git a/common/mekanism/common/ChargeUtils.java b/common/mekanism/common/ChargeUtils.java index 1f6dba2da..4e8ce8ee5 100644 --- a/common/mekanism/common/ChargeUtils.java +++ b/common/mekanism/common/ChargeUtils.java @@ -98,4 +98,52 @@ public final class ChargeUtils } } } + + /** + * Whether or not a defined ItemStack can be discharged for energy in some way. + * @param itemstack - ItemStack to check + * @return if the ItemStack can be discharged + */ + public static boolean canBeDischarged(ItemStack itemstack) + { + return (itemstack.getItem() instanceof IElectricItem && ((IElectricItem)itemstack.getItem()).canProvideEnergy(itemstack)) || + (itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).discharge(itemstack, 1, false) != 0) || + (itemstack.getItem() instanceof IChargeableItem && ((IChargeableItem)itemstack.getItem()).transferEnergy(itemstack, 1, false) != 0) || + itemstack.itemID == Item.redstone.itemID; + } + + /** + * Whether or not a defined ItemStack can be charged with energy in some way. + * @param itemstack - ItemStack to check + * @return if the ItemStack can be discharged + */ + public static boolean canBeCharged(ItemStack itemstack) + { + return itemstack.getItem() instanceof IElectricItem || + (itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).recharge(itemstack, 1, false) != 0) || + (itemstack.getItem() instanceof IChargeableItem && ((IChargeableItem)itemstack.getItem()).receiveEnergy(itemstack, 1, false) != 0); + } + + /** + * Whether or not a defined deemed-electrical ItemStack can be outputted out of a slot. + * This puts into account whether or not that slot is used for charging or discharging. + * @param itemstack - ItemStack to perform the check on + * @param chargeSlot - whether or not the outputting slot is for charging or discharging + * @return if the ItemStack can be outputted + */ + public static boolean canBeOutputted(ItemStack itemstack, boolean chargeSlot) + { + if(chargeSlot) + { + return (itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).recharge(itemstack, 1, false) == 0) || + (itemstack.getItem() instanceof IElectricItem && (!(itemstack.getItem() instanceof IItemElectric) || + ((IItemElectric)itemstack.getItem()).recharge(itemstack, 1, false) == 0)); + } + else { + return (itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).discharge(itemstack, 1, false) == 0) || + (itemstack.getItem() instanceof IElectricItem && ((IElectricItem)itemstack.getItem()).canProvideEnergy(itemstack) && + (!(itemstack.getItem() instanceof IItemElectric) || + ((IItemElectric)itemstack.getItem()).discharge(itemstack, 1, false) == 0)); + } + } } diff --git a/common/mekanism/common/ContainerAdvancedElectricMachine.java b/common/mekanism/common/ContainerAdvancedElectricMachine.java index e28ca6f80..fb92c0c31 100644 --- a/common/mekanism/common/ContainerAdvancedElectricMachine.java +++ b/common/mekanism/common/ContainerAdvancedElectricMachine.java @@ -90,7 +90,7 @@ public class ContainerAdvancedElectricMachine extends Container } } } - else if(MekanismUtils.canBeDischarged(slotStack)) + else if(ChargeUtils.canBeDischarged(slotStack)) { if(slotID != 0 && slotID != 1 && slotID != 2 && slotID != 3) { diff --git a/common/mekanism/common/ContainerElectricChest.java b/common/mekanism/common/ContainerElectricChest.java index 500fc6c5b..77536f32a 100644 --- a/common/mekanism/common/ContainerElectricChest.java +++ b/common/mekanism/common/ContainerElectricChest.java @@ -106,7 +106,7 @@ public class ContainerElectricChest extends Container ItemStack slotStack = currentSlot.getStack(); stack = slotStack.copy(); - if(MekanismUtils.canBeDischarged(slotStack)) + if(ChargeUtils.canBeDischarged(slotStack)) { if(slotID != 54) { diff --git a/common/mekanism/common/ContainerElectricMachine.java b/common/mekanism/common/ContainerElectricMachine.java index ebc6e1488..4d643e7f0 100644 --- a/common/mekanism/common/ContainerElectricMachine.java +++ b/common/mekanism/common/ContainerElectricMachine.java @@ -72,7 +72,7 @@ public class ContainerElectricMachine extends Container return null; } } - else if(MekanismUtils.canBeDischarged(slotStack)) + else if(ChargeUtils.canBeDischarged(slotStack)) { if(slotID != 1) { diff --git a/common/mekanism/common/ContainerElectricPump.java b/common/mekanism/common/ContainerElectricPump.java index 17bab4f0a..d829886ea 100644 --- a/common/mekanism/common/ContainerElectricPump.java +++ b/common/mekanism/common/ContainerElectricPump.java @@ -65,7 +65,7 @@ public class ContainerElectricPump extends Container ItemStack slotStack = currentSlot.getStack(); stack = slotStack.copy(); - if(MekanismUtils.canBeDischarged(slotStack)) + if(ChargeUtils.canBeDischarged(slotStack)) { if(slotID != 2) { diff --git a/common/mekanism/common/ContainerEnergyCube.java b/common/mekanism/common/ContainerEnergyCube.java index c814bd12e..7fff951a8 100644 --- a/common/mekanism/common/ContainerEnergyCube.java +++ b/common/mekanism/common/ContainerEnergyCube.java @@ -86,7 +86,7 @@ public class ContainerEnergyCube extends Container else { if(slotID != 1 && slotID != 0) { - if(MekanismUtils.canBeDischarged(slotStack)) + if(ChargeUtils.canBeDischarged(slotStack)) { if(!mergeItemStack(slotStack, 1, 2, false)) { diff --git a/common/mekanism/common/ContainerFactory.java b/common/mekanism/common/ContainerFactory.java index 08f7712d2..cff0c226f 100644 --- a/common/mekanism/common/ContainerFactory.java +++ b/common/mekanism/common/ContainerFactory.java @@ -140,7 +140,7 @@ public class ContainerFactory extends Container return null; } } - else if(MekanismUtils.canBeDischarged(slotStack)) + else if(ChargeUtils.canBeDischarged(slotStack)) { if(slotID != 1) { diff --git a/common/mekanism/common/ContainerMetallurgicInfuser.java b/common/mekanism/common/ContainerMetallurgicInfuser.java index 8dec0079e..512398b8f 100644 --- a/common/mekanism/common/ContainerMetallurgicInfuser.java +++ b/common/mekanism/common/ContainerMetallurgicInfuser.java @@ -85,7 +85,7 @@ public class ContainerMetallurgicInfuser extends Container return null; } } - else if(MekanismUtils.canBeDischarged(slotStack)) + else if(ChargeUtils.canBeDischarged(slotStack)) { if(!mergeItemStack(slotStack, 4, 5, false)) { diff --git a/common/mekanism/common/ContainerTeleporter.java b/common/mekanism/common/ContainerTeleporter.java index 8effb5aad..a0217486a 100644 --- a/common/mekanism/common/ContainerTeleporter.java +++ b/common/mekanism/common/ContainerTeleporter.java @@ -62,7 +62,7 @@ public class ContainerTeleporter extends Container ItemStack slotStack = currentSlot.getStack(); stack = slotStack.copy(); - if(MekanismUtils.canBeDischarged(slotStack)) + if(ChargeUtils.canBeDischarged(slotStack)) { if(slotID != 0) { diff --git a/common/mekanism/common/MekanismUtils.java b/common/mekanism/common/MekanismUtils.java index b8624005e..4f3387fc5 100644 --- a/common/mekanism/common/MekanismUtils.java +++ b/common/mekanism/common/MekanismUtils.java @@ -1,7 +1,6 @@ package mekanism.common; import ic2.api.Direction; -import ic2.api.item.IElectricItem; import java.io.BufferedReader; import java.io.IOException; @@ -25,7 +24,6 @@ import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.inventory.IInventory; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; @@ -42,7 +40,6 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; -import universalelectricity.core.item.IItemElectric; import cpw.mods.fml.common.network.PacketDispatcher; import cpw.mods.fml.server.FMLServerHandler; @@ -847,6 +844,13 @@ public final class MekanismUtils return OreDictionary.getOreName(OreDictionary.getOreID(itemStack)); } + /** + * Retrieves a private value from a defined class and field. + * @param obj - the Object to retrieve the value from, null if static + * @param c - Class to retrieve field value from + * @param field - name of declared field + * @return value as an Object, cast as necessary + */ public static Object getPrivateValue(Object obj, Class c, String field) { try { @@ -858,6 +862,13 @@ public final class MekanismUtils } } + /** + * Sets a private value from a defined class and field to a new value. + * @param obj - the Object to perform the operation on, null if static + * @param value - value to set the field to + * @param c - Class the operation will be performed on + * @param field - name of declared field + */ public static void setPrivateValue(Object obj, Object value, Class c, String field) { try { @@ -867,40 +878,22 @@ public final class MekanismUtils } catch(Exception e) {} } + /** + * Gets a ResourceLocation with a defined resource type and name. + * @param type - type of resource to retrieve + * @param name - simple name of file to retrieve as a ResourceLocation + * @return the corresponding ResourceLocation + */ public static ResourceLocation getResource(ResourceType type, String name) { return new ResourceLocation("mekanism", type.getPrefix() + name); } - public static boolean canBeDischarged(ItemStack itemstack) - { - return (itemstack.getItem() instanceof IElectricItem && ((IElectricItem)itemstack.getItem()).canProvideEnergy(itemstack)) || - (itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).discharge(itemstack, 1, false) != 0) || - itemstack.itemID == Item.redstone.itemID; - } - - public static boolean canBeCharged(ItemStack itemstack) - { - return itemstack.getItem() instanceof IElectricItem || - (itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).recharge(itemstack, 1, false) != 0); - } - - public static boolean canBeOutputted(ItemStack itemstack, boolean chargeSlot) - { - if(chargeSlot) - { - return (itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).recharge(itemstack, 1, false) == 0) || - (itemstack.getItem() instanceof IElectricItem && (!(itemstack.getItem() instanceof IItemElectric) || - ((IItemElectric)itemstack.getItem()).recharge(itemstack, 1, false) == 0)); - } - else { - return (itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).discharge(itemstack, 1, false) == 0) || - (itemstack.getItem() instanceof IElectricItem && ((IElectricItem)itemstack.getItem()).canProvideEnergy(itemstack) && - (!(itemstack.getItem() instanceof IItemElectric) || - ((IItemElectric)itemstack.getItem()).discharge(itemstack, 1, false) == 0)); - } - } - + /** + * Removes all recipes that are used to create the defined ItemStacks. + * @param itemStacks - ItemStacks to perform the operation on + * @return if any recipes were removed + */ public static boolean removeRecipes(ItemStack... itemStacks) { boolean didRemove = false; diff --git a/common/mekanism/common/SlotEnergy.java b/common/mekanism/common/SlotEnergy.java index 3b4cd74ed..97fb00573 100644 --- a/common/mekanism/common/SlotEnergy.java +++ b/common/mekanism/common/SlotEnergy.java @@ -19,7 +19,7 @@ public class SlotEnergy @Override public boolean isItemValid(ItemStack itemstack) { - return MekanismUtils.canBeCharged(itemstack); + return ChargeUtils.canBeCharged(itemstack); } } @@ -33,7 +33,7 @@ public class SlotEnergy @Override public boolean isItemValid(ItemStack itemstack) { - return MekanismUtils.canBeDischarged(itemstack); + return ChargeUtils.canBeDischarged(itemstack); } } } diff --git a/common/mekanism/common/TileEntityAdvancedElectricMachine.java b/common/mekanism/common/TileEntityAdvancedElectricMachine.java index d8e39bccc..2720d4327 100644 --- a/common/mekanism/common/TileEntityAdvancedElectricMachine.java +++ b/common/mekanism/common/TileEntityAdvancedElectricMachine.java @@ -195,7 +195,7 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM } else if(slotID == 3) { - return MekanismUtils.canBeDischarged(itemstack); + return ChargeUtils.canBeDischarged(itemstack); } else if(slotID == 1) { @@ -309,7 +309,7 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM { if(slotID == 3) { - return MekanismUtils.canBeOutputted(itemstack, false); + return ChargeUtils.canBeOutputted(itemstack, false); } else if(slotID == 2) { diff --git a/common/mekanism/common/TileEntityElectricChest.java b/common/mekanism/common/TileEntityElectricChest.java index 1313840fb..20a336eba 100644 --- a/common/mekanism/common/TileEntityElectricChest.java +++ b/common/mekanism/common/TileEntityElectricChest.java @@ -126,7 +126,7 @@ public class TileEntityElectricChest extends TileEntityElectricBlock { if(slotID == 54) { - return MekanismUtils.canBeDischarged(itemstack); + return ChargeUtils.canBeDischarged(itemstack); } else { return true; @@ -162,7 +162,7 @@ public class TileEntityElectricChest extends TileEntityElectricBlock { if(slotID == 54) { - return MekanismUtils.canBeOutputted(itemstack, false); + return ChargeUtils.canBeOutputted(itemstack, false); } else { return true; diff --git a/common/mekanism/common/TileEntityElectricMachine.java b/common/mekanism/common/TileEntityElectricMachine.java index 71ac57c65..decab37b0 100644 --- a/common/mekanism/common/TileEntityElectricMachine.java +++ b/common/mekanism/common/TileEntityElectricMachine.java @@ -142,7 +142,7 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine } else if(slotID == 1) { - return MekanismUtils.canBeDischarged(itemstack); + return ChargeUtils.canBeDischarged(itemstack); } return true; @@ -201,7 +201,7 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine { if(slotID == 1) { - return MekanismUtils.canBeOutputted(itemstack, false); + return ChargeUtils.canBeOutputted(itemstack, false); } else if(slotID == 2) { diff --git a/common/mekanism/common/TileEntityElectricPump.java b/common/mekanism/common/TileEntityElectricPump.java index c30463985..5e20616d4 100644 --- a/common/mekanism/common/TileEntityElectricPump.java +++ b/common/mekanism/common/TileEntityElectricPump.java @@ -402,7 +402,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I } else if(slotID == 2) { - return MekanismUtils.canBeDischarged(itemstack); + return ChargeUtils.canBeDischarged(itemstack); } return true; @@ -413,7 +413,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I { if(slotID == 2) { - return MekanismUtils.canBeOutputted(itemstack, false); + return ChargeUtils.canBeOutputted(itemstack, false); } else if(slotID == 1) { diff --git a/common/mekanism/common/TileEntityEnergyCube.java b/common/mekanism/common/TileEntityEnergyCube.java index 06e187c3d..ae2752569 100644 --- a/common/mekanism/common/TileEntityEnergyCube.java +++ b/common/mekanism/common/TileEntityEnergyCube.java @@ -123,11 +123,11 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn { if(slotID == 0) { - return MekanismUtils.canBeCharged(itemstack); + return ChargeUtils.canBeCharged(itemstack); } else if(slotID == 1) { - return MekanismUtils.canBeDischarged(itemstack); + return ChargeUtils.canBeDischarged(itemstack); } return true; @@ -264,11 +264,11 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn { if(slotID == 1) { - return MekanismUtils.canBeOutputted(itemstack, false); + return ChargeUtils.canBeOutputted(itemstack, false); } else if(slotID == 0) { - return MekanismUtils.canBeOutputted(itemstack, true); + return ChargeUtils.canBeOutputted(itemstack, true); } return false; diff --git a/common/mekanism/common/TileEntityFactory.java b/common/mekanism/common/TileEntityFactory.java index 684ee5f0f..d696ad543 100644 --- a/common/mekanism/common/TileEntityFactory.java +++ b/common/mekanism/common/TileEntityFactory.java @@ -287,7 +287,7 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg { if(slotID == 1) { - return MekanismUtils.canBeOutputted(itemstack, false); + return ChargeUtils.canBeOutputted(itemstack, false); } else if(tier == FactoryTier.BASIC && slotID >= 7 && slotID <= 9) { @@ -348,7 +348,7 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg } else if(slotID == 1) { - return MekanismUtils.canBeDischarged(itemstack); + return ChargeUtils.canBeDischarged(itemstack); } return true; diff --git a/common/mekanism/common/TileEntityMetallurgicInfuser.java b/common/mekanism/common/TileEntityMetallurgicInfuser.java index 19f121bb9..40f66c21c 100644 --- a/common/mekanism/common/TileEntityMetallurgicInfuser.java +++ b/common/mekanism/common/TileEntityMetallurgicInfuser.java @@ -221,7 +221,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem { if(slotID == 4) { - return MekanismUtils.canBeOutputted(itemstack, false); + return ChargeUtils.canBeOutputted(itemstack, false); } else if(slotID == 3) { @@ -268,7 +268,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem } else if(slotID == 4) { - return MekanismUtils.canBeDischarged(itemstack); + return ChargeUtils.canBeDischarged(itemstack); } return true; diff --git a/common/mekanism/common/TileEntityTeleporter.java b/common/mekanism/common/TileEntityTeleporter.java index 1bea6c011..ebdcf081f 100644 --- a/common/mekanism/common/TileEntityTeleporter.java +++ b/common/mekanism/common/TileEntityTeleporter.java @@ -105,7 +105,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements IEn { if(slotID == 0) { - return MekanismUtils.canBeDischarged(itemstack); + return ChargeUtils.canBeDischarged(itemstack); } return true; @@ -361,7 +361,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements IEn @Override public boolean canExtractItem(int slotID, ItemStack itemstack, int side) { - return MekanismUtils.canBeOutputted(itemstack, false); + return ChargeUtils.canBeOutputted(itemstack, false); } @Override diff --git a/common/mekanism/generators/common/ContainerBioGenerator.java b/common/mekanism/generators/common/ContainerBioGenerator.java index 91cad5a6f..352b2171c 100644 --- a/common/mekanism/generators/common/ContainerBioGenerator.java +++ b/common/mekanism/generators/common/ContainerBioGenerator.java @@ -1,15 +1,13 @@ package mekanism.generators.common; -import ic2.api.item.IElectricItem; +import mekanism.common.ChargeUtils; import mekanism.common.Mekanism; -import mekanism.common.MekanismUtils; import mekanism.common.SlotEnergy.SlotCharge; 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.ItemStack; -import universalelectricity.core.item.IItemElectric; public class ContainerBioGenerator extends Container { @@ -64,7 +62,7 @@ public class ContainerBioGenerator extends Container ItemStack slotStack = currentSlot.getStack(); stack = slotStack.copy(); - if(MekanismUtils.canBeCharged(slotStack)) + if(ChargeUtils.canBeCharged(slotStack)) { if(slotID != 1) { diff --git a/common/mekanism/generators/common/ContainerElectrolyticSeparator.java b/common/mekanism/generators/common/ContainerElectrolyticSeparator.java index e8272635f..fafeeafd8 100644 --- a/common/mekanism/generators/common/ContainerElectrolyticSeparator.java +++ b/common/mekanism/generators/common/ContainerElectrolyticSeparator.java @@ -2,7 +2,7 @@ package mekanism.generators.common; import mekanism.api.EnumGas; import mekanism.api.IStorageTank; -import mekanism.common.MekanismUtils; +import mekanism.common.ChargeUtils; import mekanism.common.SlotEnergy.SlotDischarge; import mekanism.common.SlotStorageTank; import net.minecraft.entity.player.EntityPlayer; @@ -105,7 +105,7 @@ public class ContainerElectrolyticSeparator extends Container } } } - else if(MekanismUtils.canBeDischarged(slotStack)) + else if(ChargeUtils.canBeDischarged(slotStack)) { if(!mergeItemStack(slotStack, 3, 4, false)) { diff --git a/common/mekanism/generators/common/ContainerHeatGenerator.java b/common/mekanism/generators/common/ContainerHeatGenerator.java index 21af45f69..460998024 100644 --- a/common/mekanism/generators/common/ContainerHeatGenerator.java +++ b/common/mekanism/generators/common/ContainerHeatGenerator.java @@ -1,14 +1,12 @@ package mekanism.generators.common; -import ic2.api.item.IElectricItem; -import mekanism.common.MekanismUtils; +import mekanism.common.ChargeUtils; import mekanism.common.SlotEnergy.SlotCharge; 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.ItemStack; -import universalelectricity.core.item.IItemElectric; public class ContainerHeatGenerator extends Container { @@ -63,7 +61,7 @@ public class ContainerHeatGenerator extends Container ItemStack slotStack = currentSlot.getStack(); stack = slotStack.copy(); - if(MekanismUtils.canBeCharged(slotStack)) + if(ChargeUtils.canBeCharged(slotStack)) { if(slotID != 1) { diff --git a/common/mekanism/generators/common/ContainerHydrogenGenerator.java b/common/mekanism/generators/common/ContainerHydrogenGenerator.java index c8ed083e2..5a2996304 100644 --- a/common/mekanism/generators/common/ContainerHydrogenGenerator.java +++ b/common/mekanism/generators/common/ContainerHydrogenGenerator.java @@ -1,16 +1,14 @@ package mekanism.generators.common; -import ic2.api.item.IElectricItem; import mekanism.api.EnumGas; import mekanism.api.IStorageTank; -import mekanism.common.MekanismUtils; +import mekanism.common.ChargeUtils; import mekanism.common.SlotEnergy.SlotCharge; 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.ItemStack; -import universalelectricity.core.item.IItemElectric; public class ContainerHydrogenGenerator extends Container { @@ -65,7 +63,7 @@ public class ContainerHydrogenGenerator extends Container ItemStack slotStack = currentSlot.getStack(); stack = slotStack.copy(); - if(MekanismUtils.canBeCharged(slotStack)) + if(ChargeUtils.canBeCharged(slotStack)) { if(slotID != 1) { diff --git a/common/mekanism/generators/common/ContainerSolarGenerator.java b/common/mekanism/generators/common/ContainerSolarGenerator.java index a5efb2a0d..9aac6a181 100644 --- a/common/mekanism/generators/common/ContainerSolarGenerator.java +++ b/common/mekanism/generators/common/ContainerSolarGenerator.java @@ -1,6 +1,6 @@ package mekanism.generators.common; -import mekanism.common.MekanismUtils; +import mekanism.common.ChargeUtils; import mekanism.common.SlotEnergy.SlotCharge; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -60,7 +60,7 @@ public class ContainerSolarGenerator extends Container ItemStack slotStack = currentSlot.getStack(); stack = slotStack.copy(); - if(MekanismUtils.canBeCharged(slotStack)) + if(ChargeUtils.canBeCharged(slotStack)) { if(slotID != 0) { diff --git a/common/mekanism/generators/common/ContainerWindTurbine.java b/common/mekanism/generators/common/ContainerWindTurbine.java index c89692ee7..ec88200e6 100644 --- a/common/mekanism/generators/common/ContainerWindTurbine.java +++ b/common/mekanism/generators/common/ContainerWindTurbine.java @@ -1,14 +1,12 @@ package mekanism.generators.common; -import ic2.api.item.IElectricItem; -import mekanism.common.MekanismUtils; +import mekanism.common.ChargeUtils; import mekanism.common.SlotEnergy.SlotCharge; 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.ItemStack; -import universalelectricity.core.item.IItemElectric; public class ContainerWindTurbine extends Container { @@ -62,7 +60,7 @@ public class ContainerWindTurbine extends Container ItemStack slotStack = currentSlot.getStack(); stack = slotStack.copy(); - if(MekanismUtils.canBeCharged(slotStack)) + if(ChargeUtils.canBeCharged(slotStack)) { if(slotID != 0) { diff --git a/common/mekanism/generators/common/TileEntityBioGenerator.java b/common/mekanism/generators/common/TileEntityBioGenerator.java index 76f566284..897c500bb 100644 --- a/common/mekanism/generators/common/TileEntityBioGenerator.java +++ b/common/mekanism/generators/common/TileEntityBioGenerator.java @@ -1,7 +1,5 @@ package mekanism.generators.common; -import ic2.api.item.IElectricItem; - import java.util.ArrayList; import mekanism.client.Sound; @@ -18,7 +16,6 @@ import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; -import universalelectricity.core.item.IItemElectric; import com.google.common.io.ByteArrayDataInput; @@ -156,7 +153,7 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements IFlui } else if(slotID == 1) { - return MekanismUtils.canBeCharged(itemstack); + return ChargeUtils.canBeCharged(itemstack); } return true; diff --git a/common/mekanism/generators/common/TileEntityElectrolyticSeparator.java b/common/mekanism/generators/common/TileEntityElectrolyticSeparator.java index f48604b7b..23929b250 100644 --- a/common/mekanism/generators/common/TileEntityElectrolyticSeparator.java +++ b/common/mekanism/generators/common/TileEntityElectrolyticSeparator.java @@ -241,7 +241,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp { if(slotID == 3) { - return MekanismUtils.canBeOutputted(itemstack, false); + return ChargeUtils.canBeOutputted(itemstack, false); } else if(slotID == 0) { @@ -276,7 +276,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp } else if(slotID == 3) { - return MekanismUtils.canBeDischarged(itemstack); + return ChargeUtils.canBeDischarged(itemstack); } return true; diff --git a/common/mekanism/generators/common/TileEntityHeatGenerator.java b/common/mekanism/generators/common/TileEntityHeatGenerator.java index 346cf5cc7..853a68d4d 100644 --- a/common/mekanism/generators/common/TileEntityHeatGenerator.java +++ b/common/mekanism/generators/common/TileEntityHeatGenerator.java @@ -115,7 +115,7 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements IFlu } else if(slotID == 1) { - return MekanismUtils.canBeCharged(itemstack); + return ChargeUtils.canBeCharged(itemstack); } return true; @@ -154,7 +154,7 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements IFlu { if(slotID == 1) { - return MekanismUtils.canBeOutputted(itemstack, true); + return ChargeUtils.canBeOutputted(itemstack, true); } else if(slotID == 0) { diff --git a/common/mekanism/generators/common/TileEntityHydrogenGenerator.java b/common/mekanism/generators/common/TileEntityHydrogenGenerator.java index 89a80258d..f5989df7a 100644 --- a/common/mekanism/generators/common/TileEntityHydrogenGenerator.java +++ b/common/mekanism/generators/common/TileEntityHydrogenGenerator.java @@ -86,7 +86,7 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements { if(slotID == 1) { - return MekanismUtils.canBeOutputted(itemstack, true); + return ChargeUtils.canBeOutputted(itemstack, true); } else if(slotID == 0) { @@ -105,7 +105,7 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements } else if(slotID == 1) { - return MekanismUtils.canBeCharged(itemstack); + return ChargeUtils.canBeCharged(itemstack); } return true; diff --git a/common/mekanism/generators/common/TileEntitySolarGenerator.java b/common/mekanism/generators/common/TileEntitySolarGenerator.java index 99db9e40f..95f51df29 100644 --- a/common/mekanism/generators/common/TileEntitySolarGenerator.java +++ b/common/mekanism/generators/common/TileEntitySolarGenerator.java @@ -106,7 +106,7 @@ public class TileEntitySolarGenerator extends TileEntityGenerator { if(slotID == 0) { - return MekanismUtils.canBeOutputted(itemstack, true); + return ChargeUtils.canBeOutputted(itemstack, true); } return false; @@ -117,7 +117,7 @@ public class TileEntitySolarGenerator extends TileEntityGenerator { if(slotID == 0) { - return MekanismUtils.canBeCharged(itemstack); + return ChargeUtils.canBeCharged(itemstack); } return true;