Skip to content

Commit

Permalink
Prevent -generation when long overflow for antimatter gen. (#3378)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Robertz <[email protected]>
  • Loading branch information
lordIcocain and Dream-Master authored Nov 16, 2024
1 parent 2d254ca commit 180f142
Showing 1 changed file with 9 additions and 0 deletions.
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("Cannot produce more than 9.2e18 EU 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

0 comments on commit 180f142

Please sign in to comment.