ElectricBlocks now output to IC2 properly.
This commit is contained in:
parent
3e71622d95
commit
f0b7f342b8
6 changed files with 42 additions and 55 deletions
|
@ -251,17 +251,6 @@ public class BlockEnergyCube extends BlockContainer implements IPeripheralProvid
|
|||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if(!world.isRemote && MekanismUtils.useIC2())
|
||||
{
|
||||
((TileEntityElectricBlock)tileEntity).register();
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock)
|
||||
{
|
||||
ItemStack itemStack = getPickBlock(null, world, x, y, z);
|
||||
|
|
|
@ -1124,20 +1124,6 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if(!world.isRemote)
|
||||
{
|
||||
if(tileEntity instanceof TileEntityElectricBlock && MekanismUtils.useIC2())
|
||||
{
|
||||
((TileEntityElectricBlock)tileEntity).register();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static enum MachineType
|
||||
{
|
||||
ENRICHMENT_CHAMBER(Mekanism.MachineBlock, 0, "EnrichmentChamber", 3, Mekanism.enrichmentChamberUsage*400, TileEntityEnrichmentChamber.class, true, false, true),
|
||||
|
|
|
@ -30,8 +30,6 @@ import ic2.api.recipe.Recipes;
|
|||
*/
|
||||
public final class MekanismHooks
|
||||
{
|
||||
private Class BasicComponents;
|
||||
|
||||
private Class BuildCraftEnergy;
|
||||
|
||||
public boolean IC2Loaded = false;
|
||||
|
@ -80,7 +78,7 @@ public final class MekanismHooks
|
|||
|
||||
}
|
||||
|
||||
@Method(modid = "IC2API")
|
||||
@Method(modid = "IC2")
|
||||
public void hookIC2Recipes()
|
||||
{
|
||||
for(Map.Entry<IRecipeInput, RecipeOutput> entry : Recipes.macerator.getRecipes().entrySet())
|
||||
|
|
|
@ -398,7 +398,7 @@ public final class OreDictManager
|
|||
try {
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Mekanism.Ingot, 1, 2), MekanismUtils.size(OreDictionary.getOres("dustBronze").get(0), 1));
|
||||
|
||||
if(Mekanism.hooks.IC2APILoaded)
|
||||
if(Mekanism.hooks.IC2Loaded)
|
||||
{
|
||||
addIC2BronzeRecipe();
|
||||
}
|
||||
|
@ -506,7 +506,7 @@ public final class OreDictManager
|
|||
|
||||
}
|
||||
|
||||
@Method(modid = "IC2API")
|
||||
@Method(modid = "IC2")
|
||||
public static void addIC2BronzeRecipe()
|
||||
{
|
||||
try {
|
||||
|
|
|
@ -4,6 +4,7 @@ import ic2.api.energy.EnergyNet;
|
|||
import ic2.api.energy.event.EnergyTileLoadEvent;
|
||||
import ic2.api.energy.event.EnergyTileUnloadEvent;
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
import ic2.api.energy.tile.IEnergySource;
|
||||
import ic2.api.energy.tile.IEnergyTile;
|
||||
import ic2.api.tile.IEnergyStorage;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
@ -16,7 +17,6 @@ import mekanism.api.energy.ICableOutputter;
|
|||
import mekanism.api.energy.IStrictEnergyAcceptor;
|
||||
import mekanism.api.energy.IStrictEnergyStorage;
|
||||
import mekanism.api.transmitters.IGridTransmitter;
|
||||
import mekanism.common.EnergyNetwork.EnergyTransferEvent;
|
||||
import mekanism.common.ITileNetwork;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
@ -42,7 +42,7 @@ import cofh.api.energy.IEnergyHandler;
|
|||
@Interface(iface = "buildcraft.api.power.IPowerReceptor", modid = "BuildCraftAPI|power"),
|
||||
@Interface(iface = "buildcraft.api.power.IPowerEmitter", modid = "BuildCraftAPI|power")
|
||||
})
|
||||
public abstract class TileEntityElectricBlock extends TileEntityContainerBlock implements ITileNetwork, IPowerEmitter, IPowerReceptor, IStrictEnergyStorage, IEnergyHandler, IEnergySink, IEnergyStorage, IStrictEnergyAcceptor, ICableOutputter
|
||||
public abstract class TileEntityElectricBlock extends TileEntityContainerBlock implements ITileNetwork, IPowerEmitter, IPowerReceptor, IStrictEnergyStorage, IEnergyHandler, IEnergySink, IEnergySource, IEnergyStorage, IStrictEnergyAcceptor, ICableOutputter
|
||||
{
|
||||
/** How much energy is stored in this block. */
|
||||
public double electricityStored;
|
||||
|
@ -226,7 +226,7 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
|
|||
@Method(modid = "BuildCraftAPI|power")
|
||||
protected void reconfigure()
|
||||
{
|
||||
powerHandler.configure(0, (float)((getMaxEnergy()-getEnergy())*Mekanism.TO_BC), 0, (float)(getMaxEnergy()*Mekanism.TO_BC));
|
||||
powerHandler.configure(0, (float)((getMaxEnergy() - getEnergy()) * Mekanism.TO_BC), 0, (float)(getMaxEnergy() * Mekanism.TO_BC));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -329,6 +329,13 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
|
|||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "IC2")
|
||||
public int getSourceTier()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "IC2")
|
||||
public void setStored(int energy)
|
||||
|
@ -361,21 +368,28 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
|
|||
@Method(modid = "IC2")
|
||||
public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction)
|
||||
{
|
||||
return !getOutputtingSides().contains(direction);
|
||||
return getConsumingSides().contains(direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "IC2")
|
||||
public boolean emitsEnergyTo(TileEntity receiver, ForgeDirection direction)
|
||||
{
|
||||
return getOutputtingSides().contains(direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "IC2")
|
||||
public int getStored()
|
||||
{
|
||||
return (int)Math.round(getEnergy()*Mekanism.TO_IC2);
|
||||
return (int)Math.round(getEnergy() * Mekanism.TO_IC2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "IC2")
|
||||
public int getCapacity()
|
||||
{
|
||||
return (int)Math.round(getMaxEnergy()*Mekanism.TO_IC2);
|
||||
return (int)Math.round(getMaxEnergy() * Mekanism.TO_IC2);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -389,7 +403,14 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
|
|||
@Method(modid = "IC2")
|
||||
public double getDemandedEnergy()
|
||||
{
|
||||
return (getMaxEnergy() - getEnergy())*Mekanism.TO_IC2;
|
||||
return (getMaxEnergy() - getEnergy()) * Mekanism.TO_IC2;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "IC2")
|
||||
public double getOfferedEnergy()
|
||||
{
|
||||
return Math.min(getEnergy(), getMaxOutput()) * Mekanism.TO_IC2;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -402,19 +423,26 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
|
|||
@Method(modid = "IC2")
|
||||
public double getOutputEnergyUnitsPerTick()
|
||||
{
|
||||
return getMaxOutput()*Mekanism.TO_IC2;
|
||||
return getMaxOutput() * Mekanism.TO_IC2;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "IC2")
|
||||
public double injectEnergy(ForgeDirection direction, double i, double v)
|
||||
public double injectEnergy(ForgeDirection direction, double amount, double voltage)
|
||||
{
|
||||
if(Coord4D.get(this).getFromSide(direction).getTileEntity(worldObj) instanceof IGridTransmitter)
|
||||
{
|
||||
return i;
|
||||
return amount;
|
||||
}
|
||||
|
||||
return i-transferEnergyToAcceptor(direction, i*Mekanism.FROM_IC2)*Mekanism.TO_IC2;
|
||||
return amount-transferEnergyToAcceptor(direction, amount*Mekanism.FROM_IC2)*Mekanism.TO_IC2;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "IC2")
|
||||
public void drawEnergy(double amount)
|
||||
{
|
||||
setEnergy(Math.max(getEnergy() - (amount * Mekanism.FROM_IC2), 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -493,20 +493,6 @@ public class BlockGenerator extends BlockContainer implements ISpecialBounds, IP
|
|||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if(!world.isRemote)
|
||||
{
|
||||
if(tileEntity != null && MekanismUtils.useIC2())
|
||||
{
|
||||
((TileEntityElectricBlock)tileEntity).register();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue