Ship with CoFH energy API (as well as a few item tidbits). It's about time

This commit is contained in:
aidancbrady 2016-03-06 12:42:04 -05:00
parent 34d55f72ea
commit 1eff6ad6b8
30 changed files with 14 additions and 54 deletions

View file

@ -14,7 +14,6 @@ import cpw.mods.fml.common.Optional.InterfaceList;
@InterfaceList({
@Interface(iface = "ic2.api.energy.tile.IEnergySink", modid = "IC2"),
@Interface(iface = "cofh.api.energy.IEnergyHandler", modid = "CoFHCore")
})
public interface IAdvancedBoundingBlock extends IBoundingBlock, ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IStrictEnergyStorage, IEnergyHandler, IComputerIntegration, ISpecialConfigData
{

View file

@ -18,8 +18,7 @@ import cpw.mods.fml.common.Optional.InterfaceList;
@InterfaceList({
@Interface(iface = "ic2.api.energy.tile.IEnergySink", modid = "IC2"),
@Interface(iface = "ic2.api.energy.tile.IEnergySource", modid = "IC2"),
@Interface(iface = "ic2.api.tile.IEnergyStorage", modid = "IC2"),
@Interface(iface = "cofh.api.energy.IEnergyHandler", modid = "CoFHCore"),
@Interface(iface = "ic2.api.tile.IEnergyStorage", modid = "IC2")
})
public interface IEnergyWrapper extends IStrictEnergyStorage, IEnergyHandler, IEnergySink, IEnergySource, IEnergyStorage, IStrictEnergyAcceptor, ICableOutputter, IInventory
{

View file

@ -40,7 +40,6 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@InterfaceList({
@Interface(iface = "cofh.api.energy.IEnergyContainerItem", modid = "CoFHCore"),
@Interface(iface = "ic2.api.item.ISpecialElectricItem", modid = "IC2")
})
public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IEnergyCube, ISpecialElectricItem, ISustainedInventory, IEnergyContainerItem

View file

@ -113,7 +113,6 @@ import cpw.mods.fml.relauncher.SideOnly;
*
*/
@InterfaceList({
@Interface(iface = "cofh.api.energy.IEnergyContainerItem", modid = "CoFHCore"),
@Interface(iface = "ic2.api.item.ISpecialElectricItem", modid = "IC2")
})
public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpecialElectricItem, IFactory, ISustainedInventory, ISustainedTank, IElectricChest, IEnergyContainerItem, IFluidContainerItem, ITierItem

View file

@ -38,8 +38,7 @@ import cpw.mods.fml.common.Optional.InterfaceList;
import cpw.mods.fml.common.Optional.Method;
@InterfaceList({
@Interface(iface = "buildcraft.api.tools.IToolWrench", modid = "BuildCraft"),
@Interface(iface = "cofh.api.item.IToolHammer", modid = "CoFHCore")
@Interface(iface = "buildcraft.api.tools.IToolWrench", modid = "BuildCraft")
})
public class ItemConfigurator extends ItemEnergized implements IMekWrench, IToolWrench, IToolHammer
{

View file

@ -23,7 +23,6 @@ import cpw.mods.fml.common.Optional.InterfaceList;
import cpw.mods.fml.common.Optional.Method;
@InterfaceList({
@Interface(iface = "cofh.api.energy.IEnergyContainerItem", modid = "CoFHCore"),
@Interface(iface = "ic2.api.item.ISpecialElectricItem", modid = "IC2")
})
public class ItemEnergized extends ItemMekanism implements IEnergizedItem, ISpecialElectricItem, IEnergyContainerItem

View file

@ -36,7 +36,6 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@InterfaceList({
@Interface(iface = "cofh.api.energy.IEnergyContainerItem", modid = "CoFHCore"),
@Interface(iface = "ic2.api.item.ISpecialElectricItem", modid = "IC2")
})
public class ItemFreeRunners extends ItemArmor implements IEnergizedItem, ISpecialElectricItem, IEnergyContainerItem

View file

@ -30,15 +30,9 @@ import codechicken.lib.data.MCDataOutput;
import codechicken.lib.vec.Vector3;
import cofh.api.energy.IEnergyHandler;
import cofh.api.energy.IEnergyProvider;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.Optional.InterfaceList;
import cpw.mods.fml.common.Optional.Method;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@InterfaceList({
@Interface(iface = "cofh.api.energy.IEnergyHandler", modid = "CoFHCore"),
})
public class PartUniversalCable extends PartTransmitter<EnergyAcceptorWrapper, EnergyNetwork> implements IStrictEnergyAcceptor, IEnergyHandler
{
public Tier.CableTier tier;
@ -177,6 +171,7 @@ public class PartUniversalCable extends PartTransmitter<EnergyAcceptorWrapper, E
public void save(NBTTagCompound nbtTags)
{
super.save(nbtTags);
nbtTags.setDouble("cacheEnergy", lastWrite);
nbtTags.setInteger("tier", tier.ordinal());
}
@ -271,7 +266,6 @@ public class PartUniversalCable extends PartTransmitter<EnergyAcceptorWrapper, E
}
@Override
@Method(modid = "CoFHCore")
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate)
{
if(canReceiveEnergy(from))
@ -283,28 +277,24 @@ public class PartUniversalCable extends PartTransmitter<EnergyAcceptorWrapper, E
}
@Override
@Method(modid = "CoFHCore")
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate)
{
return 0;
}
@Override
@Method(modid = "CoFHCore")
public boolean canConnectEnergy(ForgeDirection from)
{
return canConnect(from);
}
@Override
@Method(modid = "CoFHCore")
public int getEnergyStored(ForgeDirection from)
{
return (int)Math.round(getEnergy() * general.TO_TE);
}
@Override
@Method(modid = "CoFHCore")
public int getMaxEnergyStored(ForgeDirection from)
{
return (int)Math.round(getMaxEnergy() * general.TO_TE);

View file

@ -19,8 +19,7 @@ import cpw.mods.fml.common.Optional.InterfaceList;
import cpw.mods.fml.common.Optional.Method;
@InterfaceList({
@Interface(iface = "ic2.api.energy.tile.IEnergySink", modid = "IC2"),
@Interface(iface = "cofh.api.energy.IEnergyHandler", modid = "CoFHCore")
@Interface(iface = "ic2.api.energy.tile.IEnergySink", modid = "IC2")
})
public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock implements ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IEnergyHandler, IComputerIntegration, ISpecialConfigData
{
@ -197,7 +196,6 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp
}
@Override
@Method(modid = "CoFHCore")
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate)
{
if(getInv() == null)
@ -209,7 +207,6 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp
}
@Override
@Method(modid = "CoFHCore")
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate)
{
if(getInv() == null)
@ -221,7 +218,6 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp
}
@Override
@Method(modid = "CoFHCore")
public boolean canConnectEnergy(ForgeDirection from)
{
if(getInv() == null)
@ -233,7 +229,6 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp
}
@Override
@Method(modid = "CoFHCore")
public int getEnergyStored(ForgeDirection from)
{
if(getInv() == null)
@ -245,7 +240,6 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp
}
@Override
@Method(modid = "CoFHCore")
public int getMaxEnergyStored(ForgeDirection from)
{
if(getInv() == null)

View file

@ -208,7 +208,6 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
}
@Override
@Method(modid = "CoFHCore")
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate)
{
if(getConsumingSides().contains(from))
@ -227,7 +226,6 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
}
@Override
@Method(modid = "CoFHCore")
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate)
{
if(getOutputtingSides().contains(from))
@ -246,21 +244,18 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
}
@Override
@Method(modid = "CoFHCore")
public boolean canConnectEnergy(ForgeDirection from)
{
return getConsumingSides().contains(from) || getOutputtingSides().contains(from);
}
@Override
@Method(modid = "CoFHCore")
public int getEnergyStored(ForgeDirection from)
{
return (int)Math.round(getEnergy()*general.TO_TE);
}
@Override
@Method(modid = "CoFHCore")
public int getMaxEnergyStored(ForgeDirection from)
{
return (int)Math.round(getMaxEnergy()*general.TO_TE);

View file

@ -36,8 +36,7 @@ import cpw.mods.fml.common.Optional.Method;
@InterfaceList({
@Interface(iface = "ic2.api.energy.tile.IEnergySink", modid = "IC2"),
@Interface(iface = "ic2.api.energy.tile.IEnergySource", modid = "IC2"),
@Interface(iface = "ic2.api.tile.IEnergyStorage", modid = "IC2"),
@Interface(iface = "cofh.api.energy.IEnergyHandler", modid = "CoFHCore"),
@Interface(iface = "ic2.api.tile.IEnergyStorage", modid = "IC2")
})
public class TileEntityInductionPort extends TileEntityInductionCasing implements IEnergyWrapper, IConfigurable, IActiveState
{
@ -224,7 +223,6 @@ public class TileEntityInductionPort extends TileEntityInductionCasing implement
}
@Override
@Method(modid = "CoFHCore")
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate)
{
if(getConsumingSides().contains(from))
@ -244,7 +242,6 @@ public class TileEntityInductionPort extends TileEntityInductionCasing implement
}
@Override
@Method(modid = "CoFHCore")
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate)
{
if(getOutputtingSides().contains(from))
@ -264,21 +261,18 @@ public class TileEntityInductionPort extends TileEntityInductionCasing implement
}
@Override
@Method(modid = "CoFHCore")
public boolean canConnectEnergy(ForgeDirection from)
{
return structure != null;
}
@Override
@Method(modid = "CoFHCore")
public int getEnergyStored(ForgeDirection from)
{
return (int)Math.round(getEnergy()*general.TO_TE);
}
@Override
@Method(modid = "CoFHCore")
public int getMaxEnergyStored(ForgeDirection from)
{
return (int)Math.round(getMaxEnergy()*general.TO_TE);

View file

@ -1258,7 +1258,7 @@ public final class MekanismUtils
*/
public static boolean useRF()
{
return Mekanism.hooks.CoFHCoreLoaded && !general.blacklistRF;
return !general.blacklistRF;
}
/**
@ -1393,6 +1393,7 @@ public final class MekanismUtils
int dmgDiff1 = theItem.getMaxDamage() - dmgItems[1].getItemDamageForDisplay();
int value = dmgDiff0 + dmgDiff1 + theItem.getMaxDamage() * 5 / 100;
int solve = Math.max(0, theItem.getMaxDamage() - value);
return new ItemStack(dmgItems[0].getItem(), 1, solve);
}

View file

@ -57,7 +57,6 @@ import cpw.mods.fml.relauncher.SideOnly;
*/
@InterfaceList({
@Interface(iface = "cofh.api.energy.IEnergyContainerItem", modid = "CoFHCore"),
@Interface(iface = "ic2.api.item.ISpecialElectricItem", modid = "IC2")
})
public class ItemBlockGenerator extends ItemBlock implements IEnergizedItem, ISpecialElectricItem, ISustainedInventory, ISustainedTank, IEnergyContainerItem

View file

@ -31,8 +31,7 @@ import cpw.mods.fml.common.Optional.Method;
@InterfaceList({
@Interface(iface = "ic2.api.energy.tile.IEnergySink", modid = "IC2"),
@Interface(iface = "ic2.api.energy.tile.IEnergySource", modid = "IC2"),
@Interface(iface = "ic2.api.tile.IEnergyStorage", modid = "IC2"),
@Interface(iface = "cofh.api.energy.IEnergyHandler", modid = "CoFHCore"),
@Interface(iface = "ic2.api.tile.IEnergyStorage", modid = "IC2")
})
public class TileEntityTurbineValve extends TileEntityTurbineCasing implements IFluidHandler, IEnergyWrapper
{
@ -176,14 +175,12 @@ public class TileEntityTurbineValve extends TileEntityTurbineCasing implements I
}
@Override
@Method(modid = "CoFHCore")
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate)
{
return 0;
}
@Override
@Method(modid = "CoFHCore")
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate)
{
if(getOutputtingSides().contains(from))
@ -202,21 +199,18 @@ public class TileEntityTurbineValve extends TileEntityTurbineCasing implements I
}
@Override
@Method(modid = "CoFHCore")
public boolean canConnectEnergy(ForgeDirection from)
{
return structure != null;
}
@Override
@Method(modid = "CoFHCore")
public int getEnergyStored(ForgeDirection from)
{
return (int)Math.round(getEnergy()*general.TO_TE);
}
@Override
@Method(modid = "CoFHCore")
public int getMaxEnergyStored(ForgeDirection from)
{
return (int)Math.round(getMaxEnergy()*general.TO_TE);