Search in sources :

Example 31 with AspectList

use of thaumcraft.api.aspects.AspectList in project PneumaticCraft by MineMaarten.

the class ThaumcraftApi method exists.

/**
 * Checks to see if the passed item/block already has aspects associated with it.
 * @param id
 * @param meta
 * @return
 */
public static boolean exists(Item item, int meta) {
    AspectList tmp = ThaumcraftApi.objectTags.get(Arrays.asList(item, meta));
    if (tmp == null) {
        tmp = ThaumcraftApi.objectTags.get(Arrays.asList(item, OreDictionary.WILDCARD_VALUE));
        if (meta == OreDictionary.WILDCARD_VALUE && tmp == null) {
            int index = 0;
            do {
                tmp = ThaumcraftApi.objectTags.get(Arrays.asList(item, index));
                index++;
            } while (index < 16 && tmp == null);
        }
        if (tmp == null)
            return false;
    }
    return true;
}
Also used : AspectList(thaumcraft.api.aspects.AspectList)

Example 32 with AspectList

use of thaumcraft.api.aspects.AspectList in project PneumaticCraft by MineMaarten.

the class CrucibleRecipe method removeMatching.

public AspectList removeMatching(AspectList itags) {
    AspectList temptags = new AspectList();
    temptags.aspects.putAll(itags.aspects);
    for (Aspect tag : aspects.getAspects()) {
        temptags.remove(tag, aspects.getAmount(tag));
    }
    itags = temptags;
    return itags;
}
Also used : AspectList(thaumcraft.api.aspects.AspectList) Aspect(thaumcraft.api.aspects.Aspect)

Example 33 with AspectList

use of thaumcraft.api.aspects.AspectList in project PneumaticCraft by MineMaarten.

the class ItemFocusBasic method addInformation.

@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
    AspectList al = this.getVisCost(stack);
    if (al != null && al.size() > 0) {
        list.add(StatCollector.translateToLocal(isVisCostPerTick(stack) ? "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);
        }
    }
    addFocusInformation(stack, player, list, par4);
}
Also used : AspectList(thaumcraft.api.aspects.AspectList) DecimalFormat(java.text.DecimalFormat) Aspect(thaumcraft.api.aspects.Aspect)

Example 34 with AspectList

use of thaumcraft.api.aspects.AspectList in project PneumaticCraft by MineMaarten.

the class ThaumcraftApiHelper method getAllAspects.

public static AspectList getAllAspects(int amount) {
    if (allAspects.get(amount) == null) {
        AspectList al = new AspectList();
        for (Aspect aspect : Aspect.aspects.values()) {
            al.add(aspect, amount);
        }
        allAspects.put(amount, al);
    }
    return allAspects.get(amount);
}
Also used : AspectList(thaumcraft.api.aspects.AspectList) Aspect(thaumcraft.api.aspects.Aspect)

Example 35 with AspectList

use of thaumcraft.api.aspects.AspectList in project PneumaticCraft by MineMaarten.

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);
}
Also used : AspectList(thaumcraft.api.aspects.AspectList) Aspect(thaumcraft.api.aspects.Aspect)

Aggregations

AspectList (thaumcraft.api.aspects.AspectList)39 Aspect (thaumcraft.api.aspects.Aspect)22 ItemStack (net.minecraft.item.ItemStack)15 DecimalFormat (java.text.DecimalFormat)3 Block (net.minecraft.block.Block)2 SideOnly (cpw.mods.fml.relauncher.SideOnly)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 Map (java.util.Map)1 IGas (ladysnake.gaspunk.api.IGas)1 EnumDetector (mods.railcraft.common.blocks.detector.EnumDetector)1 EnumColor (mods.railcraft.common.plugins.color.EnumColor)1 Entity (net.minecraft.entity.Entity)1 EntityItem (net.minecraft.entity.item.EntityItem)1 BlockPos (net.minecraft.util.math.BlockPos)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1 ThaumcraftApi (thaumcraft.api.ThaumcraftApi)1 IAspectContainer (thaumcraft.api.aspects.IAspectContainer)1 IEssentiaContainerItem (thaumcraft.api.aspects.IEssentiaContainerItem)1 ItemGenericEssentiaContainer (thaumcraft.api.items.ItemGenericEssentiaContainer)1