mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-12-06 14:28:05 +00:00
Correctly obey stack limits in OffsetStorage.extract/insert
Many thanks to Lem for managing to reproduce it. It was actually an easy bug bug to spot on second look, but having a reliable way to verify was super helpful. Fixes #1338
This commit is contained in:
@@ -111,7 +111,7 @@ public class FabricContainerTransfer implements ContainerTransfer {
|
||||
|
||||
long transferred = 0;
|
||||
for (var i = 0; i < size; i++) {
|
||||
transferred += slots.get(wrap(i, size)).insert(resource, maxAmount, transaction);
|
||||
transferred += slots.get(wrap(i, size)).insert(resource, maxAmount - transferred, transaction);
|
||||
if (transferred >= maxAmount) break;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public class FabricContainerTransfer implements ContainerTransfer {
|
||||
|
||||
long transferred = 0;
|
||||
for (var i = 0; i < size; i++) {
|
||||
transferred += slots.get(wrap(i, size)).extract(resource, maxAmount, transaction);
|
||||
transferred += slots.get(wrap(i, size)).extract(resource, maxAmount - transferred, transaction);
|
||||
if (transferred >= maxAmount) break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user