Skip to content

Commit

Permalink
[#497] Fixed 32 signed integer overflow with RS Bridge functions when…
Browse files Browse the repository at this point in the history
… too many external storages(Or with a huge size) or too many disks were used.
  • Loading branch information
SirEndii committed Aug 4, 2023
1 parent 5d156b1 commit 1f7a45f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ public static boolean isFluidCraftable(INetwork network, FluidStack stack) {
return network.getCraftingManager().getPattern(stack) != null;
}

public static int getMaxItemDiskStorage(INetwork network) {
int total = 0;
public static long getMaxItemDiskStorage(INetwork network) {
long total = 0;
boolean creative = false;
for (IStorage<ItemStack> store : network.getItemStorageCache().getStorages()) {
if (store instanceof IStorageDisk<ItemStack> storageDisk) {
Expand All @@ -126,8 +126,8 @@ public static int getMaxItemDiskStorage(INetwork network) {
return creative ? -1 : total;
}

public static int getMaxFluidDiskStorage(INetwork network) {
int total = 0;
public static long getMaxFluidDiskStorage(INetwork network) {
long total = 0;
boolean creative = false;
for (IStorage<FluidStack> store : network.getFluidStorageCache().getStorages()) {
if (store instanceof IStorageDisk<FluidStack> storageDisk) {
Expand All @@ -139,8 +139,8 @@ public static int getMaxFluidDiskStorage(INetwork network) {
return creative ? -1 : total;
}

public static int getMaxItemExternalStorage(INetwork network) {
int total = 0;
public static long getMaxItemExternalStorage(INetwork network) {
long total = 0;
for (IStorage<ItemStack> store : network.getItemStorageCache().getStorages()) {
if (store instanceof IExternalStorage<ItemStack> externalStorage) {
total += externalStorage.getCapacity();
Expand All @@ -149,8 +149,8 @@ public static int getMaxItemExternalStorage(INetwork network) {
return total;
}

public static int getMaxFluidExternalStorage(INetwork network) {
int total = 0;
public static long getMaxFluidExternalStorage(INetwork network) {
long total = 0;
for (IStorage<FluidStack> store : network.getFluidStorageCache().getStorages()) {
if (store instanceof IExternalStorage<FluidStack> externalStorage) {
total += externalStorage.getCapacity();
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ logoFile = "pack.png"
modId = "advancedperipherals"
version = "${file.jarVersion}"
displayName = "Advanced Peripherals"
displayURL = "https://docs.srendi.de/"
displayURL = "https://docs.intelligence-modding.de/"
authors = "Srendi"
description = '''
Advanced Peripherals is a mod that adds many useful extensions for CC:Tweaked(Computercraft).
Expand Down

0 comments on commit 1f7a45f

Please sign in to comment.