Search in sources :

Example 11 with AspectList

use of thaumcraft.api.aspects.AspectList in project Railcraft by Railcraft.

the class ThaumcraftApiHelper method makeCrystal.

/**
 * Create a crystal itemstack from a sent aspect.
 * @param aspect
 * @param stackSize stack size
 * @return
 */
public static ItemStack makeCrystal(Aspect aspect, int stackSize) {
    if (aspect == null)
        return null;
    ItemStack is = new ItemStack(ItemsTC.crystalEssence, stackSize, 0);
    ((ItemGenericEssentiaContainer) ItemsTC.crystalEssence).setAspects(is, new AspectList().add(aspect, 1));
    return is;
}
Also used : AspectList(thaumcraft.api.aspects.AspectList) ItemStack(net.minecraft.item.ItemStack) ItemGenericEssentiaContainer(thaumcraft.api.items.ItemGenericEssentiaContainer)

Example 12 with AspectList

use of thaumcraft.api.aspects.AspectList in project Railcraft by Railcraft.

the class ItemGenericEssentiaContainer method getSubItems.

@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) {
    for (Aspect tag : Aspect.aspects.values()) {
        ItemStack i = new ItemStack(this);
        this.setAspects(i, new AspectList().add(tag, base));
        items.add(i);
    }
}
Also used : AspectList(thaumcraft.api.aspects.AspectList) Aspect(thaumcraft.api.aspects.Aspect) ItemStack(net.minecraft.item.ItemStack)

Example 13 with AspectList

use of thaumcraft.api.aspects.AspectList in project Railcraft by Railcraft.

the class CrucibleRecipe method removeMatching.

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

Example 14 with AspectList

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

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>
 * IMPORTANT - this should only be used if you are not happy with the default aspects the object would be assigned.
 * @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);
    }
}
Also used : AspectList(thaumcraft.api.aspects.AspectList) Aspect(thaumcraft.api.aspects.Aspect)

Example 15 with AspectList

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

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() > 6) {
        Aspect lowest = null;
        float low = Short.MAX_VALUE;
        for (Aspect tag : temp2.getAspects()) {
            if (tag == null)
                continue;
            float ta = temp2.getAmount(tag);
            if (tag.isPrimal()) {
                ta *= .9f;
            } else {
                if (!tag.getComponents()[0].isPrimal()) {
                    ta *= 1.1f;
                    if (!tag.getComponents()[0].getComponents()[0].isPrimal()) {
                        ta *= 1.05f;
                    }
                    if (!tag.getComponents()[0].getComponents()[1].isPrimal()) {
                        ta *= 1.05f;
                    }
                }
                if (!tag.getComponents()[1].isPrimal()) {
                    ta *= 1.1f;
                    if (!tag.getComponents()[1].getComponents()[0].isPrimal()) {
                        ta *= 1.05f;
                    }
                    if (!tag.getComponents()[1].getComponents()[1].isPrimal()) {
                        ta *= 1.05f;
                    }
                }
            }
            if (ta < low) {
                low = ta;
                lowest = tag;
            }
        }
        temp2.aspects.remove(lowest);
    }
    return temp2;
}
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