Browse Source

0.3.5, fix GitHub/#14

master
asie 1 year ago
parent
commit
1c1ccf5d1e

+ 1
- 1
build.gradle View File

@@ -13,7 +13,7 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'net.minecrell.licenser'
version = "0.3.4"
version = "0.3.5"
group = "pl.asie.preston" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "Preston"

+ 3
- 0
docs/changelog/0.3.5.txt View File

@@ -0,0 +1,3 @@
Bugs fixed:

* [GitHub/#14] "BigInteger out of int range" crash in VeryLargeMachineEnergyStorage

+ 3
- 3
src/main/java/pl/asie/preston/util/VeryLargeMachineEnergyStorage.java View File

@@ -52,7 +52,7 @@ public class VeryLargeMachineEnergyStorage implements IEnergyStorage, INBTSerial
@Override
public int receiveEnergy(int maxReceive, boolean simulate) {
BigInteger maxEnergyAccept = getCurrentMaxEnergy().subtract(energy);
if (getCurrentMaxEnergy().compareTo(MAX_INT) < 0) {
if (maxEnergyAccept.compareTo(MAX_INT) <= 0) {
maxReceive = Math.min(maxEnergyAccept.intValueExact(), maxReceive);
}

@@ -70,7 +70,7 @@ public class VeryLargeMachineEnergyStorage implements IEnergyStorage, INBTSerial

@Override
public int getEnergyStored() {
if (energy.compareTo(MAX_INT) > 0) {
if (energy.compareTo(MAX_INT) >= 0) {
return Integer.MAX_VALUE;
} else {
return energy.intValueExact();
@@ -79,7 +79,7 @@ public class VeryLargeMachineEnergyStorage implements IEnergyStorage, INBTSerial

@Override
public int getMaxEnergyStored() {
if (getCurrentMaxEnergy().compareTo(MAX_INT) > 0) {
if (getCurrentMaxEnergy().compareTo(MAX_INT) >= 0) {
return Integer.MAX_VALUE;
} else {
return getCurrentMaxEnergy().intValueExact();

Loading…
Cancel
Save