updated power systems
AL should now run on IC2 and BC power using a prefab class from one of the code libraries
This commit is contained in:
parent
290631cf8a
commit
9c4c2461fa
3 changed files with 3 additions and 91 deletions
|
@ -143,7 +143,7 @@ public class AssemblyLine
|
|||
itemImprint = new ItemImprinter(CONFIGURATION.getItem("Imprint", ITEM_ID_PREFIX).getInt());
|
||||
itemDisk = new ItemDisk(CONFIGURATION.getItem("Disk", ITEM_ID_PREFIX + 1).getInt());
|
||||
|
||||
REQUIRE_NO_POWER = DEBUG || !CONFIGURATION.get("general", "requirePower", true).getBoolean(true) || PowerSystems.runPowerLess(PowerSystems.INDUSTRIALCRAFT, PowerSystems.BUILDCRAFT, PowerSystems.MEKANISM);
|
||||
REQUIRE_NO_POWER = !CONFIGURATION.get("general", "requirePower", true).getBoolean(true) || PowerSystems.runPowerLess(PowerSystems.INDUSTRIALCRAFT, PowerSystems.BUILDCRAFT, PowerSystems.MEKANISM);
|
||||
CONFIGURATION.save();
|
||||
|
||||
NetworkRegistry.instance().registerGuiHandler(this, this.proxy);
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
package assemblyline.common.machine;
|
||||
|
||||
import ic2.api.Direction;
|
||||
import ic2.api.energy.event.EnergyTileLoadEvent;
|
||||
import ic2.api.energy.event.EnergyTileUnloadEvent;
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
import universalelectricity.core.electricity.ElectricityPack;
|
||||
import universalelectricity.prefab.tile.TileEntityElectricityRunnable;
|
||||
|
||||
public abstract class TIC2Runnable extends TileEntityElectricityRunnable implements IEnergySink
|
||||
{
|
||||
@Override
|
||||
public void initiate()
|
||||
{
|
||||
super.initiate();
|
||||
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptsEnergyFrom(TileEntity emitter, Direction direction)
|
||||
{
|
||||
if (this.getConsumingSides() != null)
|
||||
{
|
||||
return this.getConsumingSides().contains(direction.toForgeDirection());
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAddedToEnergyNet()
|
||||
{
|
||||
return this.ticks > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int demandsEnergy()
|
||||
{
|
||||
return (int) Math.ceil(this.getRequest().getWatts() * UniversalElectricity.TO_IC2_RATIO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int injectEnergy(Direction direction, int i)
|
||||
{
|
||||
double givenElectricity = i * UniversalElectricity.IC2_RATIO;
|
||||
double rejects = 0;
|
||||
|
||||
if (givenElectricity > this.getWattBuffer())
|
||||
{
|
||||
rejects = givenElectricity - this.getRequest().getWatts();
|
||||
}
|
||||
|
||||
this.onReceive(new ElectricityPack(givenElectricity / this.getVoltage(), this.getVoltage()));
|
||||
|
||||
return (int) (rejects * UniversalElectricity.TO_IC2_RATIO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxSafeInput()
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package assemblyline.common.machine;
|
||||
|
||||
import dark.library.machine.TileEntityRunnableMachine;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
@ -14,7 +15,7 @@ import assemblyline.common.AssemblyLine;
|
|||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
public abstract class TileEntityAssemblyNetwork extends TIC2Runnable
|
||||
public abstract class TileEntityAssemblyNetwork extends TileEntityRunnableMachine
|
||||
{
|
||||
/**
|
||||
* The range in which power can be transfered.
|
||||
|
@ -97,18 +98,4 @@ public abstract class TileEntityAssemblyNetwork extends TIC2Runnable
|
|||
{
|
||||
return 30;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setDouble("wattsReceived", this.wattsReceived);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.readFromNBT(nbt);
|
||||
this.wattsReceived = nbt.getDouble("wattsReceived");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue