Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent -generation when long overflow for antimatter gen. #3378

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ public void createEU(long antimatter, FluidStack catalyst) {
euCapacity += tLaserSource.maxEUStore();
}
}

// Prevent -Generation when long overflow
if (generatedEU < 0) generatedEU = Long.MAX_VALUE;
if (euCapacity < 0) euCapacity = Long.MAX_VALUE;

generatedEU = Math.min(generatedEU, euCapacity);
this.euLastCycle = generatedEU;
addEUToGlobalEnergyMap(owner_uuid, generatedEU);
Expand Down Expand Up @@ -342,6 +347,7 @@ protected MultiblockTooltipBuilder createTooltip() {
+ EnumChatFormatting.GRAY)
.addSeparator()
.addInfo("Antimatter base energy value: " + GTUtility.formatNumbers(ANTIMATTER_FUEL_VALUE) + " EU/L")
.addInfo("Limited by 9 223 372 036 854 775 807 per cycle")
.addInfo("Energy production is exponentially increased depending on the matter used:")
.addInfo("Molten Copper: 1.00")
.addInfo("Molten SC UIV Base: 1.02")
Expand Down Expand Up @@ -413,6 +419,9 @@ public String[] getInfoData() {
maxEnergy += tHatch.getBaseMetaTileEntity()
.getEUCapacity();
}
// Prevent -Value when long overflow
if (storedEnergy < 0) storedEnergy = Long.MAX_VALUE;
if (maxEnergy < 0) maxEnergy = Long.MAX_VALUE;

return new String[] { EnumChatFormatting.BLUE + "Antimatter Forge " + EnumChatFormatting.GRAY,
StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": "
Expand Down