Skip to content

Commit

Permalink
Remove crossbow ammo in case something invalid got loaded somehow (or…
Browse files Browse the repository at this point in the history
… through remappings) #1278
  • Loading branch information
bonii-xx committed Jan 1, 2015
1 parent 4b4627c commit 28ccf12
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/tconstruct/weaponry/weapons/Crossbow.java
Expand Up @@ -48,7 +48,15 @@ public ItemStack getLoadedAmmo(ItemStack itemStack)
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
Expand Down

0 comments on commit 28ccf12

Please sign in to comment.