Active management for that Miner.
This commit is contained in:
parent
323690ffdb
commit
25f1a72a16
3 changed files with 16 additions and 3 deletions
|
@ -229,7 +229,7 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
|
||||||
|
|
||||||
if(handler.canInterface(acceptorDirections.get(acceptor).getOpposite()))
|
if(handler.canInterface(acceptorDirections.get(acceptor).getOpposite()))
|
||||||
{
|
{
|
||||||
if(handler.getMaxEnergyStored(acceptorDirections.get(acceptor).getOpposite()) - handler.getEnergyStored(acceptorDirections.get(acceptor).getOpposite()) > 0)
|
if(handler.receiveEnergy(acceptorDirections.get(acceptor).getOpposite(), 1, true) > 0)
|
||||||
{
|
{
|
||||||
toReturn.add(acceptor);
|
toReturn.add(acceptor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,8 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||||
|
|
||||||
public boolean running;
|
public boolean running;
|
||||||
|
|
||||||
|
public double prevEnergy;
|
||||||
|
|
||||||
/** This machine's current RedstoneControl type. */
|
/** This machine's current RedstoneControl type. */
|
||||||
public RedstoneControl controlType = RedstoneControl.DISABLED;
|
public RedstoneControl controlType = RedstoneControl.DISABLED;
|
||||||
|
|
||||||
|
@ -125,6 +127,8 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||||
|
|
||||||
if(running && getEnergy() >= MekanismUtils.getEnergyPerTick(getSpeedMultiplier(), getEnergyMultiplier(), ENERGY_USAGE) && searcher.state == State.FINISHED && oresToMine.size() > 0)
|
if(running && getEnergy() >= MekanismUtils.getEnergyPerTick(getSpeedMultiplier(), getEnergyMultiplier(), ENERGY_USAGE) && searcher.state == State.FINISHED && oresToMine.size() > 0)
|
||||||
{
|
{
|
||||||
|
setActive(true);
|
||||||
|
|
||||||
if(delay > 0)
|
if(delay > 0)
|
||||||
{
|
{
|
||||||
delay--;
|
delay--;
|
||||||
|
@ -187,6 +191,12 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if(prevEnergy >= getEnergy())
|
||||||
|
{
|
||||||
|
setActive(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(playersUsing.size() > 0)
|
if(playersUsing.size() > 0)
|
||||||
{
|
{
|
||||||
|
@ -195,6 +205,8 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||||
PacketHandler.sendPacket(Transmission.SINGLE_CLIENT, new PacketTileEntity().setParams(Object3D.get(this), getGenericPacket(new ArrayList())), player);
|
PacketHandler.sendPacket(Transmission.SINGLE_CLIENT, new PacketTileEntity().setParams(Object3D.get(this), getGenericPacket(new ArrayList())), player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prevEnergy = getEnergy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -349,11 +349,12 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate)
|
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate)
|
||||||
{
|
|
||||||
if(!simulate)
|
|
||||||
{
|
{
|
||||||
ArrayList list = new ArrayList();
|
ArrayList list = new ArrayList();
|
||||||
list.add(Object3D.get(this).getFromSide(from).getTileEntity(worldObj));
|
list.add(Object3D.get(this).getFromSide(from).getTileEntity(worldObj));
|
||||||
|
|
||||||
|
if(!simulate)
|
||||||
|
{
|
||||||
return maxReceive - (int)Math.round(getTransmitterNetwork().emit(maxReceive*Mekanism.FROM_TE, list)*Mekanism.TO_TE);
|
return maxReceive - (int)Math.round(getTransmitterNetwork().emit(maxReceive*Mekanism.FROM_TE, list)*Mekanism.TO_TE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue