Removed IPowerless

This commit is contained in:
Calclavia 2014-01-11 17:30:24 +08:00
parent e8b0e56a80
commit d362bab7c4
3 changed files with 9 additions and 52 deletions

View file

@ -143,13 +143,6 @@ public abstract class TileAssembly extends TileEntityEnergyMachine implements IN
return 1;// 1J/t or 20J/t
}
@Override
public void togglePowerMode()
{
super.togglePowerMode();
((NetworkSharedPower) this.getTileNetwork()).setPowerLess(!this.runPowerLess());
}
@Override
public long getEnergyStored()
{

View file

@ -26,7 +26,7 @@ import universalelectricity.api.vector.VectorHelper;
*
* @author DarkGuardsman
*/
public abstract class TileEntityEnergyMachine extends TileEntityMachine implements IEnergyInterface, IEnergyContainer, IPowerLess, IVoltageInput, IVoltageOutput
public abstract class TileEntityEnergyMachine extends TileEntityMachine implements IEnergyInterface, IEnergyContainer, IVoltageInput, IVoltageOutput
{
/** Forge Ore Directory name of the item to toggle infinite power mode */
public static String powerToggleItemID = "battery";
@ -78,7 +78,7 @@ public abstract class TileEntityEnergyMachine extends TileEntityMachine implemen
@Override
public boolean canFunction()
{
return super.canFunction() && (this.runPowerLess() || this.consumePower(this.JOULES_PER_TICK, false));
return super.canFunction() && (this.consumePower(this.JOULES_PER_TICK, false));
}
/** Called when a player activates the tile's block */
@ -118,7 +118,7 @@ public abstract class TileEntityEnergyMachine extends TileEntityMachine implemen
@Override
public long onReceiveEnergy(ForgeDirection from, long receive, boolean doReceive)
{
if (!this.runPowerLess() && this.getInputDirections().contains(from) && receive > 0)
if (this.getInputDirections().contains(from) && receive > 0)
{
long prevEnergyStored = Math.max(this.getEnergy(from), 0);
long newStoredEnergy = Math.min(this.getEnergy(from) + receive, this.getEnergyCapacity(from));
@ -139,7 +139,8 @@ public abstract class TileEntityEnergyMachine extends TileEntityMachine implemen
{
return true;
}
if (!this.runPowerLess() && this.getEnergy(ForgeDirection.UNKNOWN) >= watts)
if (this.getEnergy(ForgeDirection.UNKNOWN) >= watts)
{
if (doDrain)
{
@ -147,7 +148,7 @@ public abstract class TileEntityEnergyMachine extends TileEntityMachine implemen
}
return true;
}
return this.runPowerLess();
return false;
}
@Override
@ -323,21 +324,8 @@ public abstract class TileEntityEnergyMachine extends TileEntityMachine implemen
return 0;
}
@Override
public boolean runPowerLess()
{
return !runWithoutPower;
}
@Override
public void setPowerLess(boolean bool)
{
runWithoutPower = !bool;
}
public void togglePowerMode()
{
this.setPowerLess(!this.runPowerLess());
}
public long getJoulesPerTick()

View file

@ -10,7 +10,7 @@ import resonantinduction.core.tilenetwork.INetworkPart;
*
* @author DarkGuardsman
*/
public class NetworkSharedPower extends NetworkTileEntities implements IPowerLess
public class NetworkSharedPower extends NetworkTileEntities
{
private long energy, energyMax;
private boolean runPowerLess;
@ -28,7 +28,7 @@ public class NetworkSharedPower extends NetworkTileEntities implements IPowerLes
public long addPower(TileEntity entity, long receive, boolean doReceive)
{
if (!this.runPowerLess() && receive > 0)
if (receive > 0)
{
long prevEnergyStored = this.getEnergy();
long newStoredEnergy = Math.min(this.getEnergy() + receive, this.getEnergyCapacity());
@ -65,11 +65,7 @@ public class NetworkSharedPower extends NetworkTileEntities implements IPowerLes
this.energyMax = 0;
for (INetworkPart part : this.networkMembers)
{
if (!set && part instanceof IPowerLess && ((IPowerLess) part).runPowerLess())
{
this.setPowerLess(((IPowerLess) part).runPowerLess());
set = true;
}
if (part instanceof INetworkEnergyPart)
{
this.energyMax += ((INetworkEnergyPart) part).getPartMaxEnergy();
@ -78,26 +74,6 @@ public class NetworkSharedPower extends NetworkTileEntities implements IPowerLes
}
@Override
public boolean runPowerLess()
{
return this.runPowerLess;
}
@Override
public void setPowerLess(boolean bool)
{
this.runPowerLess = bool;
for (INetworkPart part : this.networkMembers)
{
if (part instanceof IPowerLess)
{
((IPowerLess) part).setPowerLess(bool);
}
}
}
public void setEnergy(long energy)
{
this.energy = energy;