Search in sources :

Example 6 with AspectList

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

the class ThaumcraftPlugin method addBrickAspects.

private static void addBrickAspects(BrickTheme brick, int baseAmount, Aspect... baseAspects) {
    Block block = brick.getBlock();
    if (block == null)
        return;
    AspectList aspects = new AspectList().add(Aspect.EARTH, 4);
    for (Aspect a : baseAspects) {
        aspects.add(a, baseAmount);
    }
    ThaumcraftApi.registerObjectTag(new ItemStack(block, 1, OreDictionary.WILDCARD_VALUE), aspects);
    ThaumcraftApi.registerObjectTag(brick.getStack(BrickVariant.COBBLE), aspects.copy().remove(Aspect.EARTH, 2).add(Aspect.ENTROPY, 2));
    ThaumcraftApi.registerObjectTag(brick.getStack(BrickVariant.BLOCK), aspects.copy().remove(Aspect.EARTH, 2).add(Aspect.ORDER, 2));
    ThaumcraftApi.registerObjectTag(brick.getStack(BrickVariant.ETCHED), aspects.copy().remove(Aspect.EARTH, 2).add(Aspect.DESIRE, 2));
}
Also used : AspectList(thaumcraft.api.aspects.AspectList) Block(net.minecraft.block.Block) Aspect(thaumcraft.api.aspects.Aspect) ItemStack(net.minecraft.item.ItemStack)

Example 7 with AspectList

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

the class ScanAspect method checkThing.

@Override
public boolean checkThing(EntityPlayer player, Object obj) {
    if (obj == null)
        return false;
    AspectList al = null;
    if (obj instanceof Entity && !(obj instanceof EntityItem)) {
        al = AspectHelper.getEntityAspects((Entity) obj);
    } else {
        ItemStack is = null;
        if (obj instanceof ItemStack)
            is = (ItemStack) obj;
        if (obj instanceof EntityItem && ((EntityItem) obj).getItem() != null)
            is = ((EntityItem) obj).getItem();
        if (obj instanceof BlockPos) {
            Block b = player.world.getBlockState((BlockPos) obj).getBlock();
            is = new ItemStack(b, 1, b.getMetaFromState(player.world.getBlockState((BlockPos) obj)));
        }
        if (is != null) {
            al = AspectHelper.getObjectAspects(is);
        }
    }
    return al != null && al.getAmount(aspect) > 0;
}
Also used : Entity(net.minecraft.entity.Entity) AspectList(thaumcraft.api.aspects.AspectList) Block(net.minecraft.block.Block) BlockPos(net.minecraft.util.math.BlockPos) ItemStack(net.minecraft.item.ItemStack) EntityItem(net.minecraft.entity.item.EntityItem)

Example 8 with AspectList

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

the class ThaumcraftPlugin method setupResearch.

// private static Map<String, ResearchPage> researchPages = new HashMap<String, ResearchPage>();
public static void setupResearch() {
    // ResearchCategories.registerCategory(RESEARCH_CATEGORY, null, new ResourceLocation("railcraft", "textures/items/tool.crowbar.magic.png"), new ResourceLocation("thaumcraft", "textures/gui/gui_researchback.png"));
    // 
    // // Apothecaries Backpack
    // Item item = RailcraftItems.BACKPACK_APOTHECARY_T1.item();
    // if (item != null) {
    // ThaumcraftApi.addArcaneCraftingRecipe("RC_ApothecariesBackpack", false,
    // new ShapedArcaneRecipe("RC_ApothecariesBackpack", RailcraftItems.BACKPACK_APOTHECARY_T1.getStack(), 0,
    // new ItemStack[] {},
    // "X#X",
    // "VYV",
    // "X#X",
    // '#', Blocks.WOOL,
    // 'V', Items.GLASS_BOTTLE,
    // 'X', Items.STRING,
    // 'Y', "chestWood"));
    // 
    // AspectList aspects = new AspectList();
    // aspects.add(Aspect.VOID, 3).add(Aspect.CRAFT, 3).add(Aspect.MOTION, 2);
    // 
    // ResearchItem backpack = new ResearchItemRC("RC_ApothecariesBackpack", ThaumcraftPlugin.RESEARCH_CATEGORY, aspects, 2, 0, 6, RailcraftItems.BACKPACK_APOTHECARY_T1.getStack());
    // backpack.setPages(ThaumcraftPlugin.getResearchPage("RC_ApothecariesBackpack"), new ResearchPage(recipe)).setParentsHidden("ENCHFABRIC").registerResearchItem();
    // }
    // 
    // // Thaumium Crowbar
    // item = RailcraftItems.CROWBAR_THAUMIUM.item();
    // if (item != null) {
    // String researchTag = "RC_Crowbar_Thaumium";
    // ThaumcraftApi.addArcaneCraftingRecipe(researchTag, false, new ShapedArcaneRecipe(researchTag, new ItemStack(item),
    // 0,
    // new ItemStack[] {},
    // " RI",
    // "RIR",
    // "IR ",
    // 'I', ThaumcraftPlugin.ITEMS.get("ingots", 0),
    // 'R', "dyeRed"));
    // 
    // AspectList aspects = new AspectList();
    // aspects.add(Aspect.TOOL, 1).add(Aspect.MECHANISM, 2).add(Aspect.METAL, 1);
    // 
    // ResearchItem thaumiumCrowbar = new ResearchItemRC(researchTag, ThaumcraftPlugin.RESEARCH_CATEGORY, aspects, 0, 0, 3, new ItemStack(item));
    // thaumiumCrowbar.setPages(ThaumcraftPlugin.getResearchPage(researchTag), new ResearchPage(recipe))
    // .setParentsHidden("THAUMIUM")
    // .registerResearchItem();
    // }
    // 
    // // Void Crowbar
    // item = RailcraftItems.CROWBAR_VOID.item();
    // if (item != null) {
    // String researchTag = "RC_Crowbar_Void";
    // ResourceLocation key = RailcraftConstantsAPI.locationOf(researchTag);
    // IArcaneRecipe recipe = ThaumcraftApi.addArcaneCraftingRecipe(
    // key,
    // new ShapedArcaneRecipe(key, researchTag, 0,
    // new AspectList().add(Aspect.ENTROPY, 50),
    // new ItemStack(item),
    // " RI",
    // "RIR",
    // "IR ",
    // 'I', ThaumcraftPlugin.ITEMS.get("ingots", 1),
    // 'R', "dyeRed")
    // );
    AspectList aspects = new AspectList();
    aspects.add(Aspect.TOOL, 2).add(Aspect.MECHANISM, 4).add(Aspect.METAL, 2);
// ResearchItemRC voidCrowbar = new ResearchItemRC(researchTag, ThaumcraftPlugin.RESEARCH_CATEGORY, aspects, 0, 1, 3, new ItemStack(item));
// voidCrowbar.setPages(ThaumcraftPlugin.getResearchPage(researchTag), new ResearchPage(recipe))
// .setParents(researchTag).setParentsHidden("VOIDMETAL")
// .registerResearchItem();
}
Also used : AspectList(thaumcraft.api.aspects.AspectList)

Example 9 with AspectList

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

the class ThaumcraftApi method registerObjectTag.

/**
 * Used to assign apsects to the given ore dictionary item.
 * @param oreDict the ore dictionary name
 * @param aspects A ObjectTags object of the associated aspects
 */
public static void registerObjectTag(String oreDict, AspectList aspects) {
    if (aspects == null)
        aspects = new AspectList();
    List<ItemStack> ores = ThaumcraftApiHelper.getOresWithWildCards(oreDict);
    if (ores != null && ores.size() > 0) {
        for (ItemStack ore : ores) {
            try {
                ItemStack oc = ore.copy();
                oc.setCount(1);
                registerObjectTag(oc, aspects.copy());
            } catch (Exception e) {
            }
        }
    }
}
Also used : AspectList(thaumcraft.api.aspects.AspectList) ItemStack(net.minecraft.item.ItemStack)

Example 10 with AspectList

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

the class ThaumcraftApi method registerComplexObjectTag.

/**
 * Used to assign apsects to the given ore dictionary item.
 * Attempts to automatically generate aspect tags by checking registered recipes.
 * IMPORTANT - this should only be used if you are not happy with the default aspects the object would be assigned.
 * @param oreDict the ore dictionary name
 * @param aspects A ObjectTags object of the associated aspects
 */
public static void registerComplexObjectTag(String oreDict, AspectList aspects) {
    if (aspects == null)
        aspects = new AspectList();
    List<ItemStack> ores = ThaumcraftApiHelper.getOresWithWildCards(oreDict);
    if (ores != null && ores.size() > 0) {
        for (ItemStack ore : ores) {
            try {
                ItemStack oc = ore.copy();
                oc.setCount(1);
                registerComplexObjectTag(oc, aspects.copy());
            } catch (Exception e) {
            }
        }
    }
}
Also used : AspectList(thaumcraft.api.aspects.AspectList) ItemStack(net.minecraft.item.ItemStack)

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