Fix wireless grid not charging in EU
This commit is contained in:
@@ -298,14 +298,18 @@ public final class RefinedStorageUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keep this on par with the Forestry generators
|
// Keep this on par with the Forestry generators (1 EU is worth 4 RF)
|
||||||
// 1 EU is worth 4 RF
|
|
||||||
public static int convertIC2ToRF(double amount) {
|
public static int convertIC2ToRF(double amount) {
|
||||||
return (int) amount * 4;
|
// IC2 passes infinity sometimes as a simulate test
|
||||||
|
if (amount >= Double.POSITIVE_INFINITY) {
|
||||||
|
return Integer.MAX_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (int) Math.floor(amount) * 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double convertRFToIC2(int amount) {
|
public static double convertRFToIC2(int amount) {
|
||||||
return amount / 4;
|
return Math.floor(amount / 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack extractItem(INetworkMaster network, ItemStack stack, int size) {
|
public static ItemStack extractItem(INetworkMaster network, ItemStack stack, int size) {
|
||||||
|
@@ -101,7 +101,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
private List<ICraftingTask> craftingTasksToCancel = new ArrayList<ICraftingTask>();
|
private List<ICraftingTask> craftingTasksToCancel = new ArrayList<ICraftingTask>();
|
||||||
|
|
||||||
private EnergyStorage energy = new EnergyStorage(RefinedStorage.INSTANCE.controller);
|
private EnergyStorage energy = new EnergyStorage(RefinedStorage.INSTANCE.controller);
|
||||||
private BasicSink IC2Energy = new BasicSink(this, energy.getMaxEnergyStored(), Integer.MAX_VALUE) {
|
private BasicSink IC2Energy = new BasicSink(this, (int) convertRFToIC2(energy.getMaxEnergyStored()), Integer.MAX_VALUE) {
|
||||||
@Override
|
@Override
|
||||||
public double getDemandedEnergy() {
|
public double getDemandedEnergy() {
|
||||||
return Math.max(0.0D, convertRFToIC2(energy.getMaxEnergyStored()) - convertRFToIC2(energy.getEnergyStored()));
|
return Math.max(0.0D, convertRFToIC2(energy.getMaxEnergyStored()) - convertRFToIC2(energy.getEnergyStored()));
|
||||||
|
Reference in New Issue
Block a user