From 03ece540e6446a3d4cefd327a5aadaefbafaaa43 Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Fri, 3 Apr 2015 19:07:39 +0200 Subject: [PATCH] More verbose ammo-stacking when picking up ammo. Should fix projectiles not being pickupable (that is a word now) after they got xp. --- .../tconstruct/library/weaponry/AmmoItem.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/main/java/tconstruct/library/weaponry/AmmoItem.java b/src/main/java/tconstruct/library/weaponry/AmmoItem.java index aeb80b94..9f58769c 100644 --- a/src/main/java/tconstruct/library/weaponry/AmmoItem.java +++ b/src/main/java/tconstruct/library/weaponry/AmmoItem.java @@ -114,9 +114,23 @@ public abstract class AmmoItem extends ToolCore implements IAmmo { // create a stack to test against ItemStack testsubject = candidate.copy(); - // all NBT has to match, but the ammo-count obviously differs. So we set our testsubject to the same - // this ensures that it's the one to collect and the one we have matches. - testsubject.getTagCompound().getCompoundTag("InfiTool").setInteger("Ammo", getAmmoCount(reference)); + reference = reference.copy(); + // all NBT has to match, but the ammo-count obviously differs. + // we strip known tags that have no impact + + NBTTagCompound tags = testsubject.getTagCompound().getCompoundTag("InfiTool"); + tags.removeTag("Ammo"); + tags.removeTag("ToolEXP"); + tags.removeTag("ToolLevel"); + tags.removeTag("HeadEXP"); + tags.removeTag("Damage"); + + tags = reference.getTagCompound().getCompoundTag("InfiTool"); + tags.removeTag("Ammo"); + tags.removeTag("ToolEXP"); + tags.removeTag("ToolLevel"); + tags.removeTag("HeadEXP"); + tags.removeTag("Damage"); return ItemStack.areItemStacksEqual(reference, testsubject); }