(ItemStack aStack, NBTTagCompound aNBT)
| 2013 | } |
| 2014 | |
| 2015 | public static ItemStack set(ItemStack aStack, NBTTagCompound aNBT) { |
| 2016 | if (aNBT == null || aNBT.hasNoTags()) {aStack.setTagCompound(null); return aStack;} |
| 2017 | ArrayList<String> tTagsToRemove = new ArrayListNoNulls<>(); |
| 2018 | for (Object tKey : aNBT.func_150296_c()) { |
| 2019 | NBTBase tValue = aNBT.getTag((String)tKey); |
| 2020 | if (tValue == null || (tValue instanceof NBTTagCompound && ((NBTTagCompound)tValue).hasNoTags()) || (tValue instanceof NBTPrimitive && ((NBTPrimitive)tValue).func_150291_c() == 0) || (tValue instanceof NBTTagString && Code.stringInvalid(((NBTTagString)tValue).func_150285_a_()))) tTagsToRemove.add((String)tKey); |
| 2021 | } |
| 2022 | for (Object tKey : tTagsToRemove) aNBT.removeTag((String)tKey); |
| 2023 | aStack.setTagCompound(aNBT.hasNoTags()?null:aNBT); |
| 2024 | return aStack; |
| 2025 | } |
| 2026 | |
| 2027 | public static NBTTagCompound getNBT(ItemStack aStack) { |
| 2028 | NBTTagCompound rNBT = aStack.getTagCompound(); |
no test coverage detected