MCPcopy Index your code
hub / github.com/GregTech6/gregtech6 / set

Method set

src/main/java/gregapi/util/UT.java:2015–2025  ·  view source on GitHub ↗
(ItemStack aStack, NBTTagCompound aNBT)

Source from the content-addressed store, hash-verified

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();

Callers 15

displayMethod · 0.95
displayMethod · 0.95
getWrittenBookMethod · 0.95
getBookWithTitleMethod · 0.95
createWrittenBookMethod · 0.95
checkMethod · 0.95
setPunchCardDataMethod · 0.95
setBlueprintCraftingMethod · 0.95
setLighterFuelMethod · 0.95
setMapIDMethod · 0.95
setMagicMapIDMethod · 0.95
setMazeMapIDMethod · 0.95

Calls 2

stringInvalidMethod · 0.95
addMethod · 0.95

Tested by

no test coverage detected