public static void addAspects(ItemStack is, AspectList aspects) { AspectList has = ThaumcraftApi.objectTags.get(Arrays.asList(is.getItem(), is.getItemDamage())); if (has != null) { for (Aspect as : has.aspects.keySet()) { aspects.merge(as, has.getAmount(as)); } } clearNullAspects(aspects); ThaumcraftApi.registerObjectTag(is, new int[] {is.getItemDamage()}, aspects); DragonAPICore.log("Registering " + is + " aspects " + aspectsToString(aspects)); }
/** Contains a helper function to avoid overwriting existing aspects. */ public static void addAspects(ItemStack is, Object... aspects) { if (aspects.length % 2 != 0) { DragonAPICore.logError( "Could not add aspects to " + is + ": You must specify a level for every aspect!"); ReikaJavaLibrary.dumpStack(); return; } AspectList has = ThaumcraftApi.objectTags.get(Arrays.asList(is.getItem(), is.getItemDamage())); AspectList ot = getAspectList(aspects); if (has != null) { for (Aspect as : has.aspects.keySet()) { ot.merge(as, has.getAmount(as)); } } clearNullAspects(ot); ThaumcraftApi.registerObjectTag(is, ot); DragonAPICore.log("Registering " + is + " aspects " + aspectsToString(ot)); }