IC2 support updated to 304 and fixed

This commit is contained in:
MachineMuse 2013-04-25 04:18:19 -06:00
parent 10b1e8bedb
commit a5809a64fd
4 changed files with 10 additions and 21 deletions

View file

@ -1,10 +1,10 @@
package net.machinemuse.api.electricity package net.machinemuse.api.electricity
import ic2.api.IElectricItem
import net.minecraft.item.ItemStack import net.minecraft.item.ItemStack
import thermalexpansion.api.item.IChargeableItem import thermalexpansion.api.item.IChargeableItem
import universalelectricity.core.item.IItemElectric import universalelectricity.core.item.IItemElectric
import net.machinemuse.powersuits.common.ModCompatability import net.machinemuse.powersuits.common.ModCompatability
import ic2.api.item.IElectricItem
object ElectricAdapter { object ElectricAdapter {
implicit def wrap(stack: ItemStack): ElectricAdapter = { implicit def wrap(stack: ItemStack): ElectricAdapter = {

View file

@ -1,10 +1,10 @@
package net.machinemuse.api.electricity package net.machinemuse.api.electricity
import ic2.api.{ICustomElectricItem, ElectricItem, IElectricItem}
import net.minecraft.item.ItemStack import net.minecraft.item.ItemStack
import net.machinemuse.api.ModuleManager import net.machinemuse.api.ModuleManager
import net.machinemuse.powersuits.common.ModCompatability import net.machinemuse.powersuits.common.ModCompatability
import IC2PowerConversions._ import IC2PowerConversions._
import ic2.api.item.{ICustomElectricItem, IElectricItem, ElectricItem}
class IC2ElectricAdapter(val stack: ItemStack) extends ElectricAdapter { class IC2ElectricAdapter(val stack: ItemStack) extends ElectricAdapter {
val item = stack.getItem.asInstanceOf[IElectricItem] val item = stack.getItem.asInstanceOf[IElectricItem]
@ -30,9 +30,7 @@ class IC2ElectricAdapter(val stack: ItemStack) extends ElectricAdapter {
return museEnergyFromEU(givenEU) return museEnergyFromEU(givenEU)
} }
def getTier: Int = { def getTier = item.getTier(stack)
return IC2PowerConversions.getTier(stack)
}
} }
trait IC2ElectricItem extends ICustomElectricItem with MuseElectricItem { 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 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] def getTransferLimit(itemStack: ItemStack): Int = museEnergyToEU(Math.sqrt(getMaxEnergy(itemStack))).asInstanceOf[Int]

View file

@ -245,8 +245,8 @@ public class ItemPowerGauntlet extends ItemElectricTool
} }
@Override @Override
public boolean onItemUseFirst(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, public boolean onItemUseFirst(ItemStack itemStack, EntityPlayer player, World world,
float hitZ) { int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
String mode = MuseItemUtils.getActiveMode(itemStack); String mode = MuseItemUtils.getActiveMode(itemStack);
IPowerModule module = ModuleManager.getModule(mode); IPowerModule module = ModuleManager.getModule(mode);
if (module instanceof IRightClickModule) { if (module instanceof IRightClickModule) {
@ -283,10 +283,7 @@ public class ItemPowerGauntlet extends ItemElectricTool
// Railcraft // Railcraft
@Override @Override
public boolean canWhack(EntityPlayer player, ItemStack crowbar, int x, int y, int z) { 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(crowbar, OmniWrenchModule.MODULE_OMNI_WRENCH);
return MuseItemUtils.itemHasActiveModule(player.getCurrentEquippedItem(), OmniWrenchModule.MODULE_OMNI_WRENCH);
}
return false;
} }
@Override @Override
@ -296,10 +293,7 @@ public class ItemPowerGauntlet extends ItemElectricTool
@Override @Override
public boolean canLink(EntityPlayer player, ItemStack crowbar, EntityMinecart cart) { public boolean canLink(EntityPlayer player, ItemStack crowbar, EntityMinecart cart) {
if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof IModularItem) { return MuseItemUtils.itemHasActiveModule(crowbar, OmniWrenchModule.MODULE_OMNI_WRENCH);
return MuseItemUtils.itemHasActiveModule(player.getCurrentEquippedItem(), OmniWrenchModule.MODULE_OMNI_WRENCH) && player.isSneaking();
}
return false;
} }
@Override @Override
@ -309,10 +303,7 @@ public class ItemPowerGauntlet extends ItemElectricTool
@Override @Override
public boolean canBoost(EntityPlayer player, ItemStack crowbar, EntityMinecart cart) { public boolean canBoost(EntityPlayer player, ItemStack crowbar, EntityMinecart cart) {
if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof IModularItem) { return MuseItemUtils.itemHasActiveModule(crowbar, OmniWrenchModule.MODULE_OMNI_WRENCH);
return MuseItemUtils.itemHasActiveModule(player.getCurrentEquippedItem(), OmniWrenchModule.MODULE_OMNI_WRENCH) && player.isSneaking();
}
return false;
} }
@Override @Override

View file

@ -2,9 +2,9 @@ package net.machinemuse.powersuits.powermodule.tool;
import cofh.api.tileentity.IReconfigurableFacing; import cofh.api.tileentity.IReconfigurableFacing;
import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.FMLClientHandler;
import ic2.api.IWrenchable;
import ic2.api.energy.tile.IEnergySink; import ic2.api.energy.tile.IEnergySink;
import ic2.api.energy.tile.IEnergySource; import ic2.api.energy.tile.IEnergySource;
import ic2.api.tile.IWrenchable;
import net.machinemuse.api.IModularItem; import net.machinemuse.api.IModularItem;
import net.machinemuse.api.moduletrigger.IRightClickModule; import net.machinemuse.api.moduletrigger.IRightClickModule;
import net.machinemuse.powersuits.item.ItemComponent; import net.machinemuse.powersuits.item.ItemComponent;