Fixed #11284 / Cap item turret ammo on save read

This commit is contained in:
Anuken
2025-10-13 20:27:47 +09:00
parent ea72441958
commit a35f7605f7
3 changed files with 4 additions and 4 deletions

View File

@@ -206,12 +206,12 @@ public class ItemTurret extends Turret{
int amount = read.ub();
for(int i = 0; i < amount; i++){
Item item = Vars.content.item(revision < 2 ? read.ub() : read.s());
short a = read.s();
int itemAmount = Math.min(read.s(), maxAmmo);
//only add ammo if this is a valid ammo type
if(item != null && ammoTypes.containsKey(item)){
totalAmmo += a;
ammo.add(new ItemEntry(item, a));
totalAmmo += itemAmount;
ammo.add(new ItemEntry(item, itemAmount));
}
}
}