make over- and underflow create another spot

This commit is contained in:
Ellpeck 2018-12-03 14:40:53 +01:00
parent 5fcd096a99
commit 656a76980b

View file

@ -61,8 +61,9 @@ public class AuraChunk implements IAuraChunk {
return 0;
MutableInt spot = this.getActualDrainSpot(pos, true);
int curr = spot.intValue();
if (curr < 0 && curr - amount > 0) // Underflow protection
return amount;
if (curr < 0 && curr - amount > 0) { // Underflow protection
return this.drainAura(pos.up(), amount, aimForZero, simulate);
}
if (aimForZero) {
if (curr > 0 && curr - amount < 0)
amount = curr;
@ -88,7 +89,7 @@ public class AuraChunk implements IAuraChunk {
MutableInt spot = this.getActualDrainSpot(pos, true);
int curr = spot.intValue();
if (curr > 0 && curr + amount < 0) // Overflow protection
return amount;
return this.storeAura(pos.up(), amount, aimForZero, simulate);
if (aimForZero) {
if (curr < 0 && curr + amount > 0) {
amount = -curr;