Applied-Energistics-2-tiler.../me/energy/EnergyThreshold.java
AlgorithmX2 eb15bd3a68 Added Energy Watcher API
Added Event to Recalculate Channel Requirements for a Node.
Level Emitter can now output redstone based on network energy levels.
Level Emitter's entry field can now hold longs ( text box supports up o trillions )
2014-02-21 00:10:38 -06:00

36 lines
659 B
Java

package appeng.me.energy;
import appeng.api.networking.energy.IEnergyWatcher;
import appeng.util.ItemSorters;
public class EnergyThreshold implements Comparable<EnergyThreshold>
{
public final double Limit;
public final IEnergyWatcher watcher;
final int hash;
public EnergyThreshold(double lim, IEnergyWatcher wat) {
Limit = lim;
watcher = wat;
if ( watcher != null )
hash = watcher.hashCode() ^ ((Double) lim).hashCode();
else
hash = ((Double) lim).hashCode();
}
@Override
public int hashCode()
{
return hash;
}
@Override
public int compareTo(EnergyThreshold o)
{
return ItemSorters.comparDouble( Limit, o.Limit );
}
}