Remove crossbow ammo in case something invalid got loaded somehow (or through remappings) #1278

This commit is contained in:
Bernhard Bonigl committed 2015-01-01 22:19:15 +01:00
1 parent 4b4627c20d
commit 28ccf1236e
1 file changed
+9 -1
@@ -48,7 +48,15 @@ public class Crossbow extends ProjectileWeapon {
if(!isLoaded(tags))
return null;
return ItemStack.loadItemStackFromNBT(tags.getCompoundTag("LoadedItem"));
ItemStack ammo = ItemStack.loadItemStackFromNBT(tags.getCompoundTag("LoadedItem"));
// prevent crashes from remapping corruptions..
if(ammo != null && ammo.getItem() != null && ammo.getItem() != TinkerWeaponry.boltAmmo) {
tags.removeTag("LoadedItem");
ammo = null;
}
return ammo;
}
@Override