File tree Expand file tree Collapse file tree 1 file changed +2
-0
lines changed
src/main/java/aztech/modern_industrialization/api/energy Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -206,6 +206,7 @@ public boolean canConnect(CableTier cableTier) {
206206 @ Override
207207 public long receive (long maxReceive , boolean simulate ) {
208208 long ratio = ratio ();
209+ maxReceive = Math .min (maxReceive , Long .MAX_VALUE / ratio ); // avoid overflow
209210 maxReceive *= ratio ;
210211 if (ratio > 1 ) {
211212 // Do a simulate insertion to round down to a multiple of ratio that should be accepted.
@@ -217,6 +218,7 @@ public long receive(long maxReceive, boolean simulate) {
217218 @ Override
218219 public long extract (long maxExtract , boolean simulate ) {
219220 long ratio = ratio ();
221+ maxExtract = Math .min (maxExtract , Long .MAX_VALUE / ratio ); // avoid overflow
220222 maxExtract *= ratio ;
221223 if (ratio > 1 ) {
222224 // Do a simulate extraction to round down to a multiple of ratio that should be accepted.
You can’t perform that action at this time.
0 commit comments