Fix wireless grid not charging in EU

This commit is contained in:
Raoul Van den Berge
2016-07-04 02:37:11 +02:00
parent e3b220ba90
commit aa02ca5fc3
2 changed files with 9 additions and 5 deletions

View File

@@ -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) {

View File

@@ -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()));