use of thaumcraft.api.aspects.Aspect in project ArsMagica2 by Mithion.
the class ItemFocusBasic method addInformation.
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
AspectList al = this.getVisCost();
if (al != null && al.size() > 0) {
list.add(StatCollector.translateToLocal(isVisCostPerTick() ? "item.Focus.cost2" : "item.Focus.cost1"));
for (Aspect aspect : al.getAspectsSorted()) {
DecimalFormat myFormatter = new DecimalFormat("#####.##");
String amount = myFormatter.format(al.getAmount(aspect) / 100f);
list.add(" \u00A7" + aspect.getChatcolor() + aspect.getName() + "\u00A7r x " + amount);
}
}
}
use of thaumcraft.api.aspects.Aspect in project ArsMagica2 by Mithion.
the class ResearchItem method getResearchPrimaryTag.
/**
* @return the aspect aspects ordinal with the highest value. Used to determine scroll color and similar things
*/
public Aspect getResearchPrimaryTag() {
Aspect aspect = null;
int highest = 0;
if (tags != null)
for (Aspect tag : tags.getAspects()) {
if (tags.getAmount(tag) > highest) {
aspect = tag;
highest = tags.getAmount(tag);
}
;
}
return aspect;
}
use of thaumcraft.api.aspects.Aspect in project ArsMagica2 by Mithion.
the class ThaumcraftApiHelper method getAllCompoundAspects.
public static AspectList getAllCompoundAspects(int amount) {
if (allCompoundAspects.get(amount) == null) {
AspectList al = new AspectList();
for (Aspect aspect : Aspect.getCompoundAspects()) {
al.add(aspect, amount);
}
allCompoundAspects.put(amount, al);
}
return allCompoundAspects.get(amount);
}
use of thaumcraft.api.aspects.Aspect in project ArsMagica2 by Mithion.
the class ThaumcraftApiHelper method cullTags.
public static AspectList cullTags(AspectList temp) {
AspectList temp2 = new AspectList();
for (Aspect tag : temp.getAspects()) {
if (tag != null)
temp2.add(tag, temp.getAmount(tag));
}
while (temp2 != null && temp2.size() > 10) {
Aspect lowest = null;
int low = Integer.MAX_VALUE;
for (Aspect tag : temp2.getAspects()) {
if (tag == null)
continue;
if (temp2.getAmount(tag) < low) {
low = temp2.getAmount(tag);
lowest = tag;
}
}
temp2.aspects.remove(lowest);
}
return temp2;
}
use of thaumcraft.api.aspects.Aspect in project ArsMagica2 by Mithion.
the class ThaumcraftApi method registerComplexObjectTag.
/**
* Used to assign aspects to the given item/block.
* Attempts to automatically generate aspect tags by checking registered recipes.
* Here is an example of the declaration for pistons:<p>
* <i>ThaumcraftApi.registerComplexObjectTag(new ItemStack(Blocks.cobblestone), (new AspectList()).add(Aspect.MECHANISM, 2).add(Aspect.MOTION, 4));</i>
* @param item, pass OreDictionary.WILDCARD_VALUE to meta if all damage values of this item/block should have the same aspects
* @param aspects A ObjectTags object of the associated aspects
*/
public static void registerComplexObjectTag(ItemStack item, AspectList aspects) {
if (!exists(item.getItem(), item.getItemDamage())) {
AspectList tmp = ThaumcraftApiHelper.generateTags(item.getItem(), item.getItemDamage());
if (tmp != null && tmp.size() > 0) {
for (Aspect tag : tmp.getAspects()) {
aspects.add(tag, tmp.getAmount(tag));
}
}
registerObjectTag(item, aspects);
} else {
AspectList tmp = ThaumcraftApiHelper.getObjectAspects(item);
for (Aspect tag : aspects.getAspects()) {
tmp.merge(tag, tmp.getAmount(tag));
}
registerObjectTag(item, tmp);
}
}
Aggregations