2014-01-08 02:55:50 +01:00
|
|
|
package mekanism.common.tile;
|
2012-10-28 23:18:23 +01:00
|
|
|
|
2013-10-09 00:06:25 +02:00
|
|
|
import ic2.api.energy.event.EnergyTileLoadEvent;
|
2013-04-13 16:33:37 +02:00
|
|
|
import ic2.api.energy.event.EnergyTileUnloadEvent;
|
2013-11-27 19:24:13 +01:00
|
|
|
import ic2.api.energy.tile.IEnergySink;
|
2013-04-13 16:33:37 +02:00
|
|
|
import ic2.api.energy.tile.IEnergyTile;
|
2013-11-27 19:24:13 +01:00
|
|
|
import ic2.api.tile.IEnergyStorage;
|
2014-06-02 16:52:13 +02:00
|
|
|
import io.netty.buffer.ByteBuf;
|
2013-04-13 16:33:37 +02:00
|
|
|
|
2013-02-27 02:21:30 +01:00
|
|
|
import java.util.ArrayList;
|
2013-03-18 17:23:57 +01:00
|
|
|
import java.util.EnumSet;
|
|
|
|
|
2013-12-20 22:09:09 +01:00
|
|
|
import mekanism.api.Coord4D;
|
2013-11-27 19:24:13 +01:00
|
|
|
import mekanism.api.energy.ICableOutputter;
|
|
|
|
import mekanism.api.energy.IStrictEnergyAcceptor;
|
2013-08-27 00:49:32 +02:00
|
|
|
import mekanism.api.energy.IStrictEnergyStorage;
|
2014-01-05 08:24:06 +01:00
|
|
|
import mekanism.api.transmitters.IGridTransmitter;
|
2013-08-27 00:49:32 +02:00
|
|
|
import mekanism.common.ITileNetwork;
|
|
|
|
import mekanism.common.Mekanism;
|
2013-11-06 02:07:38 +01:00
|
|
|
import mekanism.common.util.MekanismUtils;
|
2013-04-13 16:33:37 +02:00
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
2013-11-27 19:24:13 +01:00
|
|
|
import net.minecraft.tileentity.TileEntity;
|
2013-12-03 17:10:14 +01:00
|
|
|
import net.minecraft.world.World;
|
2013-04-13 16:33:37 +02:00
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
2014-06-02 16:52:13 +02:00
|
|
|
import net.minecraftforge.common.util.ForgeDirection;
|
2013-12-28 04:34:05 +01:00
|
|
|
import buildcraft.api.power.IPowerEmitter;
|
2013-12-03 17:10:14 +01:00
|
|
|
import buildcraft.api.power.IPowerReceptor;
|
|
|
|
import buildcraft.api.power.PowerHandler;
|
|
|
|
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
2013-11-15 18:06:03 +01:00
|
|
|
import cofh.api.energy.IEnergyHandler;
|
2012-10-28 23:18:23 +01:00
|
|
|
|
2013-12-28 04:34:05 +01:00
|
|
|
public abstract class TileEntityElectricBlock extends TileEntityContainerBlock implements ITileNetwork, IPowerEmitter, IPowerReceptor, IEnergyTile, IStrictEnergyStorage, IEnergyHandler, IEnergySink, IEnergyStorage, IStrictEnergyAcceptor, ICableOutputter
|
2012-10-28 23:18:23 +01:00
|
|
|
{
|
|
|
|
/** How much energy is stored in this block. */
|
2012-11-25 16:45:00 +01:00
|
|
|
public double electricityStored;
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2012-10-28 23:18:23 +01:00
|
|
|
/** Maximum amount of energy this machine can hold. */
|
2012-11-25 16:45:00 +01:00
|
|
|
public double MAX_ELECTRICITY;
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-12-03 17:10:14 +01:00
|
|
|
/** BuildCraft power handler. */
|
|
|
|
public PowerHandler powerHandler;
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2012-10-28 23:18:23 +01:00
|
|
|
/**
|
|
|
|
* The base of all blocks that deal with electricity. It has a facing state, initialized state,
|
|
|
|
* and a current amount of stored energy.
|
|
|
|
* @param name - full name of this block
|
|
|
|
* @param maxEnergy - how much energy this block can store
|
|
|
|
*/
|
2013-02-01 01:43:39 +01:00
|
|
|
public TileEntityElectricBlock(String name, double maxEnergy)
|
2012-10-28 23:18:23 +01:00
|
|
|
{
|
2012-11-21 16:14:35 +01:00
|
|
|
super(name);
|
2012-11-25 16:45:00 +01:00
|
|
|
MAX_ELECTRICITY = maxEnergy;
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-12-03 17:10:14 +01:00
|
|
|
powerHandler = new PowerHandler(this, PowerHandler.Type.STORAGE);
|
|
|
|
powerHandler.configurePowerPerdition(0, 0);
|
|
|
|
powerHandler.configure(0, 0, 0, 0);
|
2012-10-28 23:18:23 +01:00
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-11-03 22:54:33 +01:00
|
|
|
public void register()
|
2012-12-19 21:23:55 +01:00
|
|
|
{
|
2013-07-31 17:54:58 +02:00
|
|
|
if(!worldObj.isRemote)
|
2012-12-19 21:23:55 +01:00
|
|
|
{
|
2013-12-20 22:09:09 +01:00
|
|
|
if(!Mekanism.ic2Registered.contains(Coord4D.get(this)))
|
2013-10-09 00:06:25 +02:00
|
|
|
{
|
2013-12-20 22:09:09 +01:00
|
|
|
Mekanism.ic2Registered.add(Coord4D.get(this));
|
2013-10-09 00:06:25 +02:00
|
|
|
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
|
|
|
|
}
|
2013-11-03 22:54:33 +01:00
|
|
|
}
|
|
|
|
}
|
2014-03-08 04:00:35 +01:00
|
|
|
|
|
|
|
public void deregister()
|
|
|
|
{
|
|
|
|
if(!worldObj.isRemote)
|
|
|
|
{
|
|
|
|
if(Mekanism.ic2Registered.contains(Coord4D.get(this)))
|
|
|
|
{
|
|
|
|
Mekanism.ic2Registered.remove(Coord4D.get(this));
|
|
|
|
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-11-03 22:54:33 +01:00
|
|
|
@Override
|
2013-12-03 17:10:14 +01:00
|
|
|
public void onUpdate()
|
|
|
|
{
|
|
|
|
reconfigure();
|
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-11-29 23:17:01 +01:00
|
|
|
public EnumSet<ForgeDirection> getOutputtingSides()
|
2013-11-02 17:00:29 +01:00
|
|
|
{
|
2013-11-30 06:28:02 +01:00
|
|
|
return EnumSet.noneOf(ForgeDirection.class);
|
2013-11-02 17:00:29 +01:00
|
|
|
}
|
2013-03-18 17:23:57 +01:00
|
|
|
|
|
|
|
protected EnumSet<ForgeDirection> getConsumingSides()
|
|
|
|
{
|
2013-11-30 18:29:49 +01:00
|
|
|
EnumSet set = EnumSet.allOf(ForgeDirection.class);
|
|
|
|
set.remove(ForgeDirection.UNKNOWN);
|
|
|
|
return set;
|
2013-03-18 17:23:57 +01:00
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-11-02 17:00:29 +01:00
|
|
|
public double getMaxOutput()
|
2013-03-18 17:23:57 +01:00
|
|
|
{
|
2013-11-02 17:00:29 +01:00
|
|
|
return 0;
|
2013-03-18 17:23:57 +01:00
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-03-18 17:23:57 +01:00
|
|
|
@Override
|
2013-04-19 21:43:00 +02:00
|
|
|
public double getEnergy()
|
|
|
|
{
|
|
|
|
return electricityStored;
|
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-04-19 21:43:00 +02:00
|
|
|
@Override
|
|
|
|
public void setEnergy(double energy)
|
|
|
|
{
|
|
|
|
electricityStored = Math.max(Math.min(energy, getMaxEnergy()), 0);
|
2013-11-11 20:37:56 +01:00
|
|
|
MekanismUtils.saveChunk(this);
|
2013-04-19 21:43:00 +02:00
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-04-19 21:43:00 +02:00
|
|
|
@Override
|
|
|
|
public double getMaxEnergy()
|
2013-03-18 17:23:57 +01:00
|
|
|
{
|
|
|
|
return MAX_ELECTRICITY;
|
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-02-27 02:21:30 +01:00
|
|
|
@Override
|
2014-06-02 16:52:13 +02:00
|
|
|
public void handlePacketData(ByteBuf dataStream)
|
2013-02-27 02:21:30 +01:00
|
|
|
{
|
|
|
|
super.handlePacketData(dataStream);
|
2013-08-22 17:36:31 +02:00
|
|
|
setEnergy(dataStream.readDouble());
|
2013-02-27 02:21:30 +01:00
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-02-27 02:21:30 +01:00
|
|
|
@Override
|
|
|
|
public ArrayList getNetworkedData(ArrayList data)
|
|
|
|
{
|
|
|
|
super.getNetworkedData(data);
|
2013-08-22 17:36:31 +02:00
|
|
|
data.add(getEnergy());
|
2013-02-27 02:21:30 +01:00
|
|
|
return data;
|
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2012-12-19 21:23:55 +01:00
|
|
|
@Override
|
2013-11-03 22:54:33 +01:00
|
|
|
public void onChunkUnload()
|
2012-12-19 21:23:55 +01:00
|
|
|
{
|
2014-03-08 04:00:35 +01:00
|
|
|
deregister();
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-11-03 22:54:33 +01:00
|
|
|
super.onChunkUnload();
|
2012-12-19 21:23:55 +01:00
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2014-02-15 23:10:13 +01:00
|
|
|
@Override
|
|
|
|
public void invalidate()
|
|
|
|
{
|
|
|
|
super.invalidate();
|
2014-03-08 04:00:35 +01:00
|
|
|
|
|
|
|
deregister();
|
2014-02-15 23:10:13 +01:00
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2012-11-06 16:44:14 +01:00
|
|
|
@Override
|
2014-03-08 02:00:25 +01:00
|
|
|
public void readFromNBT(NBTTagCompound nbtTags)
|
|
|
|
{
|
|
|
|
super.readFromNBT(nbtTags);
|
2012-11-02 02:30:40 +01:00
|
|
|
|
2014-03-08 02:00:25 +01:00
|
|
|
electricityStored = nbtTags.getDouble("electricityStored");
|
|
|
|
reconfigure();
|
|
|
|
}
|
2012-11-02 02:30:40 +01:00
|
|
|
|
2012-11-06 16:44:14 +01:00
|
|
|
@Override
|
2014-03-08 02:00:25 +01:00
|
|
|
public void writeToNBT(NBTTagCompound nbtTags)
|
|
|
|
{
|
|
|
|
super.writeToNBT(nbtTags);
|
|
|
|
|
|
|
|
nbtTags.setDouble("electricityStored", getEnergy());
|
|
|
|
}
|
|
|
|
|
2013-12-03 17:10:14 +01:00
|
|
|
@Override
|
2014-03-08 02:00:25 +01:00
|
|
|
public PowerReceiver getPowerReceiver(ForgeDirection side)
|
2013-12-03 17:10:14 +01:00
|
|
|
{
|
2013-12-28 04:34:05 +01:00
|
|
|
if(getConsumingSides().contains(side))
|
|
|
|
{
|
|
|
|
return powerHandler.getPowerReceiver();
|
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-12-28 04:34:05 +01:00
|
|
|
return null;
|
2013-12-03 17:10:14 +01:00
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-12-03 17:10:14 +01:00
|
|
|
protected void reconfigure()
|
|
|
|
{
|
2013-12-23 23:06:22 +01:00
|
|
|
if(MekanismUtils.useBuildCraft())
|
2013-12-03 17:10:14 +01:00
|
|
|
{
|
|
|
|
powerHandler.configure(1, (float)((getMaxEnergy()-getEnergy())*Mekanism.TO_BC), 0, (float)(getMaxEnergy()*Mekanism.TO_BC));
|
|
|
|
}
|
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-12-03 17:10:14 +01:00
|
|
|
@Override
|
2014-03-08 02:00:25 +01:00
|
|
|
public void doWork(PowerHandler workProvider)
|
2013-12-03 17:10:14 +01:00
|
|
|
{
|
|
|
|
if(powerHandler.getEnergyStored() > 0)
|
|
|
|
{
|
|
|
|
if(getEnergy() < getMaxEnergy())
|
|
|
|
{
|
|
|
|
setEnergy(getEnergy() + powerHandler.useEnergy(0, (float)((getMaxEnergy()-getEnergy())*Mekanism.TO_BC), true)*Mekanism.FROM_BC);
|
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-12-03 17:10:14 +01:00
|
|
|
powerHandler.setEnergy(0);
|
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-12-03 17:10:14 +01:00
|
|
|
reconfigure();
|
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-12-03 17:10:14 +01:00
|
|
|
@Override
|
|
|
|
public World getWorld()
|
|
|
|
{
|
|
|
|
return worldObj;
|
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-08-22 17:36:31 +02:00
|
|
|
/**
|
|
|
|
* Gets the scaled energy level for the GUI.
|
|
|
|
* @param i - multiplier
|
|
|
|
* @return scaled energy
|
|
|
|
*/
|
|
|
|
public int getScaledEnergyLevel(int i)
|
|
|
|
{
|
|
|
|
return (int)(getEnergy()*i / getMaxEnergy());
|
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-11-15 18:06:03 +01:00
|
|
|
@Override
|
|
|
|
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate)
|
|
|
|
{
|
|
|
|
if(getConsumingSides().contains(from))
|
|
|
|
{
|
|
|
|
double toAdd = (int)Math.min(getMaxEnergy()-getEnergy(), maxReceive*Mekanism.FROM_TE);
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-11-15 18:06:03 +01:00
|
|
|
if(!simulate)
|
|
|
|
{
|
|
|
|
setEnergy(getEnergy() + toAdd);
|
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-11-21 00:17:10 +01:00
|
|
|
return (int)Math.round(toAdd*Mekanism.TO_TE);
|
2013-11-15 18:06:03 +01:00
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-11-15 18:06:03 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate)
|
|
|
|
{
|
2013-11-29 23:17:01 +01:00
|
|
|
if(getOutputtingSides().contains(from))
|
2013-11-15 18:06:03 +01:00
|
|
|
{
|
|
|
|
double toSend = Math.min(getEnergy(), Math.min(getMaxOutput(), maxExtract*Mekanism.FROM_TE));
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-11-15 18:06:03 +01:00
|
|
|
if(!simulate)
|
|
|
|
{
|
|
|
|
setEnergy(getEnergy() - toSend);
|
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-11-21 00:17:10 +01:00
|
|
|
return (int)Math.round(toSend*Mekanism.TO_TE);
|
2013-11-15 18:06:03 +01:00
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-11-15 18:06:03 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-06-15 13:35:51 +02:00
|
|
|
public boolean canConnectEnergy(ForgeDirection from)
|
2013-11-15 18:06:03 +01:00
|
|
|
{
|
2013-12-21 18:51:55 +01:00
|
|
|
return getConsumingSides().contains(from) || getOutputtingSides().contains(from);
|
2013-11-15 18:06:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getEnergyStored(ForgeDirection from)
|
|
|
|
{
|
2013-11-27 19:24:13 +01:00
|
|
|
return (int)Math.round(getEnergy()*Mekanism.TO_TE);
|
2013-11-15 18:06:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-03-08 02:00:25 +01:00
|
|
|
public int getMaxEnergyStored(ForgeDirection from)
|
2013-11-15 18:06:03 +01:00
|
|
|
{
|
2013-11-27 19:24:13 +01:00
|
|
|
return (int)Math.round(getMaxEnergy()*Mekanism.TO_TE);
|
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-11-27 19:24:13 +01:00
|
|
|
@Override
|
|
|
|
public int getMaxSafeInput()
|
|
|
|
{
|
2013-11-28 00:17:44 +01:00
|
|
|
return Integer.MAX_VALUE;
|
2013-11-27 19:24:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setStored(int energy)
|
|
|
|
{
|
|
|
|
setEnergy(energy*Mekanism.FROM_IC2);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int addEnergy(int amount)
|
|
|
|
{
|
|
|
|
setEnergy(getEnergy() + amount*Mekanism.FROM_IC2);
|
|
|
|
return (int)Math.round(getEnergy()*Mekanism.TO_IC2);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-03-08 02:00:25 +01:00
|
|
|
public boolean isTeleporterCompatible(ForgeDirection side)
|
2013-11-27 19:24:13 +01:00
|
|
|
{
|
2013-11-29 23:17:01 +01:00
|
|
|
return getOutputtingSides().contains(side);
|
2013-11-27 19:24:13 +01:00
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-11-27 19:24:13 +01:00
|
|
|
@Override
|
|
|
|
public boolean canOutputTo(ForgeDirection side)
|
|
|
|
{
|
2013-11-29 23:17:01 +01:00
|
|
|
return getOutputtingSides().contains(side);
|
2013-11-27 19:24:13 +01:00
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-11-27 19:24:13 +01:00
|
|
|
@Override
|
|
|
|
public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction)
|
|
|
|
{
|
2013-11-29 23:17:01 +01:00
|
|
|
return !getOutputtingSides().contains(direction);
|
2013-11-27 19:24:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-03-08 02:00:25 +01:00
|
|
|
public int getStored()
|
2013-11-27 19:24:13 +01:00
|
|
|
{
|
|
|
|
return (int)Math.round(getEnergy()*Mekanism.TO_IC2);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-03-08 02:00:25 +01:00
|
|
|
public int getCapacity()
|
2013-11-27 19:24:13 +01:00
|
|
|
{
|
|
|
|
return (int)Math.round(getMaxEnergy()*Mekanism.TO_IC2);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-03-08 02:00:25 +01:00
|
|
|
public int getOutput()
|
2013-11-27 19:24:13 +01:00
|
|
|
{
|
|
|
|
return (int)Math.round(getMaxOutput()*Mekanism.TO_IC2);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-03-08 02:00:25 +01:00
|
|
|
public double demandedEnergyUnits()
|
2013-11-27 19:24:13 +01:00
|
|
|
{
|
|
|
|
return (getMaxEnergy() - getEnergy())*Mekanism.TO_IC2;
|
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-11-27 19:24:13 +01:00
|
|
|
@Override
|
|
|
|
public boolean canReceiveEnergy(ForgeDirection side)
|
|
|
|
{
|
2013-12-28 04:34:05 +01:00
|
|
|
return getConsumingSides().contains(side);
|
2013-11-27 19:24:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public double getOutputEnergyUnitsPerTick()
|
|
|
|
{
|
|
|
|
return getMaxOutput()*Mekanism.TO_IC2;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-03-08 02:00:25 +01:00
|
|
|
public double injectEnergyUnits(ForgeDirection direction, double i)
|
|
|
|
{
|
2014-01-05 08:24:06 +01:00
|
|
|
if(Coord4D.get(this).getFromSide(direction).getTileEntity(worldObj) instanceof IGridTransmitter)
|
2013-11-27 19:24:13 +01:00
|
|
|
{
|
|
|
|
return i;
|
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
|
|
|
return i-transferEnergyToAcceptor(direction, i*Mekanism.FROM_IC2)*Mekanism.TO_IC2;
|
|
|
|
}
|
|
|
|
|
2013-11-27 19:24:13 +01:00
|
|
|
@Override
|
|
|
|
public double transferEnergyToAcceptor(ForgeDirection side, double amount)
|
|
|
|
{
|
2014-04-11 00:45:59 +02:00
|
|
|
if(!(getConsumingSides().contains(side) || side == ForgeDirection.UNKNOWN))
|
2013-11-27 19:24:13 +01:00
|
|
|
{
|
2014-01-09 00:28:17 +01:00
|
|
|
return 0;
|
2013-11-27 19:24:13 +01:00
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
|
|
|
double toUse = Math.min(getMaxEnergy()-getEnergy(), amount);
|
|
|
|
setEnergy(getEnergy() + toUse);
|
|
|
|
|
|
|
|
return toUse;
|
2013-11-15 18:06:03 +01:00
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-12-28 04:34:05 +01:00
|
|
|
@Override
|
2014-03-08 02:00:25 +01:00
|
|
|
public boolean canEmitPowerFrom(ForgeDirection side)
|
2013-12-28 04:34:05 +01:00
|
|
|
{
|
|
|
|
return getOutputtingSides().contains(side);
|
|
|
|
}
|
2012-10-28 23:18:23 +01:00
|
|
|
}
|