Search in sources :

Example 21 with AspectList

use of thaumcraft.api.aspects.AspectList in project LogisticsPipes by RS485.

the class ThaumCraftProxy method getTagsForStack.

/**
	 * Used to get an ObjectTags of all aspects inside a given stack.
	 * 
	 * @param stack
	 *            The stack to get ObjectTags for.
	 * @return ObjectTags containing all of the aspects for stack.
	 */
private AspectList getTagsForStack(ItemStack stack) {
    if (stack == null) {
        return new AspectList();
    }
    AspectList ot = ThaumcraftApiHelper.getObjectAspects(stack);
    ot = ThaumcraftApiHelper.getBonusObjectTags(stack, ot);
    return ot;
}
Also used : AspectList(thaumcraft.api.aspects.AspectList)

Example 22 with AspectList

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

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 23 with AspectList

use of thaumcraft.api.aspects.AspectList in project Gaspunk by Ladysnake.

the class ThaumcraftCompat method generateAspectsFromBrewing.

private static AspectList generateAspectsFromBrewing(ItemStack stack) {
    List<AspectList> all = new ArrayList<>();
    for (IBrewingRecipe recipe : BrewingRecipeRegistry.getRecipes()) {
        if (recipe instanceof AbstractBrewingRecipe) {
            ItemStack output = ((AbstractBrewingRecipe) recipe).getOutput();
            if (ItemGasTube.getContainedGas(output) == ItemGasTube.getContainedGas(stack)) {
                AspectList aspects = new AspectList();
                aspects.add(AspectHelper.getObjectAspects(((AbstractBrewingRecipe) recipe).getInput()));
                if (recipe instanceof BrewingRecipe) {
                    aspects.add(AspectHelper.getObjectAspects(((BrewingRecipe) recipe).getIngredient()));
                } else if (recipe instanceof BrewingOreRecipe) {
                    for (ItemStack ingredient : ((BrewingOreRecipe) recipe).getIngredient()) {
                        AspectList list = AspectHelper.getObjectAspects(ingredient);
                        for (Aspect aspect : list.getAspects()) {
                            aspects.add(aspect, list.getAmount(aspect) / list.size());
                        }
                    }
                }
                all.add(aspects);
            }
        }
    }
    AspectList ret = new AspectList();
    for (AspectList list : all) {
        for (Aspect aspect : list.getAspects()) {
            ret.add(aspect, list.getAmount(aspect) / all.size());
        }
    }
    return AspectHelper.cullTags(ret);
}
Also used : AspectList(thaumcraft.api.aspects.AspectList) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack) Aspect(thaumcraft.api.aspects.Aspect)

Example 24 with AspectList

use of thaumcraft.api.aspects.AspectList in project Gaspunk by Ladysnake.

the class ThaumcraftCompat method registerAspects.

public static void registerAspects() {
    ThaumcraftApi.registerObjectTag(new ItemStack(ModItems.SULFUR), new AspectList().add(Aspect.FIRE, 10).add(Aspect.EARTH, 8).add(Aspect.ENTROPY, 2));
    ThaumcraftApi.registerObjectTag(new ItemStack(ModItems.ASH), new AspectList().add(Aspect.FIRE, 7).add(Aspect.ENTROPY, 5).add(Aspect.DEATH, 10));
    ThaumcraftApi.registerObjectTag(new ItemStack(ModItems.GRENADE), new AspectList(new ItemStack(ModItems.DIFFUSER)).add(Aspect.ALCHEMY, 5).add(Aspect.ENERGY, 7).add(Aspect.AIR, 7));
    ThaumcraftApi.registerObjectTag(new ItemStack(ModItems.SMOKE_POWDER), new AspectList().add(divide(AspectHelper.getObjectAspects(new ItemStack(Items.GUNPOWDER)), 1.5)).add(Aspect.SENSES, 10).add(Aspect.AIR, 6));
    ThaumcraftApi.registerObjectTag(new ItemStack(ModItems.EMPTY_GRENADE), new AspectList(new ItemStack(ModItems.DIFFUSER)).add(Aspect.VOID, 8));
    // register the aspects for smoke first
    registerGasAspect(ModGases.SMOKE, new AspectList());
    for (IGas gas : ModGases.REGISTRY.getValues()) registerGasAspect(gas, new AspectList());
}
Also used : IGas(ladysnake.gaspunk.api.IGas) AspectList(thaumcraft.api.aspects.AspectList) ItemStack(net.minecraft.item.ItemStack)

Example 25 with AspectList

use of thaumcraft.api.aspects.AspectList 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);
        }
    }
}
Also used : AspectList(thaumcraft.api.aspects.AspectList) DecimalFormat(java.text.DecimalFormat) 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