Actually sync ItemTurret's ammo (#5154)
This commit is contained in:
committed by
GitHub
parent
8cd7e1c307
commit
6eea8bebdf
@@ -165,14 +165,16 @@ public class ItemTurret extends Turret{
|
|||||||
@Override
|
@Override
|
||||||
public void read(Reads read, byte revision){
|
public void read(Reads read, byte revision){
|
||||||
super.read(read, revision);
|
super.read(read, revision);
|
||||||
|
ammo.clear();
|
||||||
|
totalAmmo = 0;
|
||||||
int amount = read.ub();
|
int amount = read.ub();
|
||||||
for(int i = 0; i < amount; i++){
|
for(int i = 0; i < amount; i++){
|
||||||
Item item = Vars.content.item(revision < 2 ? read.ub() : read.s());
|
Item item = Vars.content.item(revision < 2 ? read.ub() : read.s());
|
||||||
short a = read.s();
|
short a = read.s();
|
||||||
totalAmmo += a;
|
|
||||||
|
|
||||||
//only add ammo if this is a valid ammo type
|
//only add ammo if this is a valid ammo type
|
||||||
if(item != null && ammoTypes.containsKey(item)){
|
if(item != null && ammoTypes.containsKey(item)){
|
||||||
|
totalAmmo += a;
|
||||||
ammo.add(new ItemEntry(item, a));
|
ammo.add(new ItemEntry(item, a));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user