Loading furnace minecart with fuel causes integer overflow in fuel counter
PORTB opened this issue ยท 3 comments
Having a furnace minecart on some sort of loop that has a minecart loader filled with fuel will eventually make the minecart's fuel counter overflow and become negative. While this normally will 'fix' itself when the counter underflows again, it causes issues with create contraptions.
This is what I used to trigger the bug
The fuel counter overflowed after the minecart was reloaded. The fuel level has to be low enough to refuel but high enough to overflow so it took a few minutes. I used the /data command to show the fuel level of the minecart
Version: moreminecarts-1.5.3
Change
if (minecart.fuel + 3600 <= 32000) {
for (ItemStack stack : items) {
if (Ingredient.of(new ItemLike[]{Items.COAL, Items.CHARCOAL}).test(stack) && !(leave_one_in_stack && stack.getCount() == 1)) {
stack.shrink(1);
minecart.fuel += 3600;
changed = true;
}
}
}
to something like
for(int stackIndex = 0; (minecart.fuel + 3600 <= 32000) && (stackIndex < items.size()); stackIndex++)
{
ItemStack stack = items.get(stackIndex);
if (Ingredient.of(new ItemLike[]{Items.COAL, Items.CHARCOAL}).test(stack) && !(leave_one_in_stack && stack.getCount() == 1)) {
stack.shrink(1);
minecart.fuel += 3600;
changed = true;
}
}
And similar for the locking rail loop above it. I didn't see your reply until just now