From a5809a64fd0021d637c960df220acf94bac42905 Mon Sep 17 00:00:00 2001 From: MachineMuse Date: Thu, 25 Apr 2013 04:18:19 -0600 Subject: [PATCH] IC2 support updated to 304 and fixed --- .../api/electricity/ElectricAdapter.scala | 2 +- .../api/electricity/IC2Electricity.scala | 8 +++----- .../powersuits/item/ItemPowerGauntlet.java | 19 +++++-------------- .../powermodule/tool/OmniWrenchModule.java | 2 +- 4 files changed, 10 insertions(+), 21 deletions(-) diff --git a/src/minecraft/net/machinemuse/api/electricity/ElectricAdapter.scala b/src/minecraft/net/machinemuse/api/electricity/ElectricAdapter.scala index dfb9201..ff7c416 100644 --- a/src/minecraft/net/machinemuse/api/electricity/ElectricAdapter.scala +++ b/src/minecraft/net/machinemuse/api/electricity/ElectricAdapter.scala @@ -1,10 +1,10 @@ package net.machinemuse.api.electricity -import ic2.api.IElectricItem import net.minecraft.item.ItemStack import thermalexpansion.api.item.IChargeableItem import universalelectricity.core.item.IItemElectric import net.machinemuse.powersuits.common.ModCompatability +import ic2.api.item.IElectricItem object ElectricAdapter { implicit def wrap(stack: ItemStack): ElectricAdapter = { diff --git a/src/minecraft/net/machinemuse/api/electricity/IC2Electricity.scala b/src/minecraft/net/machinemuse/api/electricity/IC2Electricity.scala index 9bf0644..61daaeb 100644 --- a/src/minecraft/net/machinemuse/api/electricity/IC2Electricity.scala +++ b/src/minecraft/net/machinemuse/api/electricity/IC2Electricity.scala @@ -1,10 +1,10 @@ package net.machinemuse.api.electricity -import ic2.api.{ICustomElectricItem, ElectricItem, IElectricItem} import net.minecraft.item.ItemStack import net.machinemuse.api.ModuleManager import net.machinemuse.powersuits.common.ModCompatability import IC2PowerConversions._ +import ic2.api.item.{ICustomElectricItem, IElectricItem, ElectricItem} class IC2ElectricAdapter(val stack: ItemStack) extends ElectricAdapter { val item = stack.getItem.asInstanceOf[IElectricItem] @@ -30,9 +30,7 @@ class IC2ElectricAdapter(val stack: ItemStack) extends ElectricAdapter { return museEnergyFromEU(givenEU) } - def getTier: Int = { - return IC2PowerConversions.getTier(stack) - } + def getTier = item.getTier(stack) } trait IC2ElectricItem extends ICustomElectricItem with MuseElectricItem { @@ -44,7 +42,7 @@ trait IC2ElectricItem extends ICustomElectricItem with MuseElectricItem { def getMaxCharge(itemStack: ItemStack): Int = museEnergyToEU(getCurrentEnergy(itemStack)).asInstanceOf[Int] - def getTier(itemStack: ItemStack): Int = getTier(itemStack) + def getTier(itemStack: ItemStack): Int = IC2PowerConversions.getTier(itemStack) def getTransferLimit(itemStack: ItemStack): Int = museEnergyToEU(Math.sqrt(getMaxEnergy(itemStack))).asInstanceOf[Int] diff --git a/src/minecraft/net/machinemuse/powersuits/item/ItemPowerGauntlet.java b/src/minecraft/net/machinemuse/powersuits/item/ItemPowerGauntlet.java index 1596fab..f9a073a 100644 --- a/src/minecraft/net/machinemuse/powersuits/item/ItemPowerGauntlet.java +++ b/src/minecraft/net/machinemuse/powersuits/item/ItemPowerGauntlet.java @@ -245,8 +245,8 @@ public class ItemPowerGauntlet extends ItemElectricTool } @Override - public boolean onItemUseFirst(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, - float hitZ) { + public boolean onItemUseFirst(ItemStack itemStack, EntityPlayer player, World world, + int x, int y, int z, int side, float hitX, float hitY, float hitZ) { String mode = MuseItemUtils.getActiveMode(itemStack); IPowerModule module = ModuleManager.getModule(mode); if (module instanceof IRightClickModule) { @@ -283,10 +283,7 @@ public class ItemPowerGauntlet extends ItemElectricTool // Railcraft @Override public boolean canWhack(EntityPlayer player, ItemStack crowbar, int x, int y, int z) { - if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof IModularItem) { - return MuseItemUtils.itemHasActiveModule(player.getCurrentEquippedItem(), OmniWrenchModule.MODULE_OMNI_WRENCH); - } - return false; + return MuseItemUtils.itemHasActiveModule(crowbar, OmniWrenchModule.MODULE_OMNI_WRENCH); } @Override @@ -296,10 +293,7 @@ public class ItemPowerGauntlet extends ItemElectricTool @Override public boolean canLink(EntityPlayer player, ItemStack crowbar, EntityMinecart cart) { - if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof IModularItem) { - return MuseItemUtils.itemHasActiveModule(player.getCurrentEquippedItem(), OmniWrenchModule.MODULE_OMNI_WRENCH) && player.isSneaking(); - } - return false; + return MuseItemUtils.itemHasActiveModule(crowbar, OmniWrenchModule.MODULE_OMNI_WRENCH); } @Override @@ -309,10 +303,7 @@ public class ItemPowerGauntlet extends ItemElectricTool @Override public boolean canBoost(EntityPlayer player, ItemStack crowbar, EntityMinecart cart) { - if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof IModularItem) { - return MuseItemUtils.itemHasActiveModule(player.getCurrentEquippedItem(), OmniWrenchModule.MODULE_OMNI_WRENCH) && player.isSneaking(); - } - return false; + return MuseItemUtils.itemHasActiveModule(crowbar, OmniWrenchModule.MODULE_OMNI_WRENCH); } @Override diff --git a/src/minecraft/net/machinemuse/powersuits/powermodule/tool/OmniWrenchModule.java b/src/minecraft/net/machinemuse/powersuits/powermodule/tool/OmniWrenchModule.java index c2450c6..e4f1c58 100644 --- a/src/minecraft/net/machinemuse/powersuits/powermodule/tool/OmniWrenchModule.java +++ b/src/minecraft/net/machinemuse/powersuits/powermodule/tool/OmniWrenchModule.java @@ -2,9 +2,9 @@ package net.machinemuse.powersuits.powermodule.tool; import cofh.api.tileentity.IReconfigurableFacing; import cpw.mods.fml.client.FMLClientHandler; -import ic2.api.IWrenchable; import ic2.api.energy.tile.IEnergySink; import ic2.api.energy.tile.IEnergySource; +import ic2.api.tile.IWrenchable; import net.machinemuse.api.IModularItem; import net.machinemuse.api.moduletrigger.IRightClickModule; import net.machinemuse.powersuits.item.ItemComponent;