Search in sources :

Example 1 with AspectList

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

the class ThaumCraftProxy method getListOfTagsForStack.

/**
	 * Used to get a list of integers representing the IDs of all the aspects in
	 * the given ItemStack. Returns null if object has no tags.
	 * 
	 * @param stack
	 *            The item to get tags for.
	 * @return An Integer list of aspect IDs.
	 */
@Override
public List<String> getListOfTagsForStack(ItemStack stack) {
    if (stack == null) {
        return null;
    }
    List<String> list = new LinkedList<>();
    AspectList tags = getTagsForStack(stack);
    Aspect[] tagArray = tags.getAspectsSorted();
    if (tagArray.length == 0 || tagArray == null) {
        return null;
    }
    for (Aspect element : tagArray) {
        if (element == null) {
            continue;
        }
        list.add(element.getTag());
    }
    return list;
}
Also used : AspectList(thaumcraft.api.aspects.AspectList) Aspect(thaumcraft.api.aspects.Aspect) LinkedList(java.util.LinkedList)

Example 2 with AspectList

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

the class ItemGenericEssentiaContainer method getSubItems.

@SideOnly(Side.CLIENT)
@Override
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
    for (Aspect tag : Aspect.aspects.values()) {
        ItemStack i = new ItemStack(this);
        this.setAspects(i, new AspectList().add(tag, base));
        par3List.add(i);
    }
}
Also used : AspectList(thaumcraft.api.aspects.AspectList) Aspect(thaumcraft.api.aspects.Aspect) ItemStack(net.minecraft.item.ItemStack) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 3 with AspectList

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

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(I18n.translateToLocal(isVisCostPerTick(stack) ? "item.Focus.cost2" : "item.Focus.cost1"));
        for (Aspect aspect : al.getAspectsSortedByName()) {
            DecimalFormat myFormatter = new DecimalFormat("#####.##");
            String amount = myFormatter.format(al.getAmount(aspect));
            list.add(" §" + aspect.getChatcolor() + aspect.getName() + "§r x " + amount);
        }
    }
    addFocusInformation(stack, player, list, par4);
}
Also used : AspectList(thaumcraft.api.aspects.AspectList) DecimalFormat(java.text.DecimalFormat) Aspect(thaumcraft.api.aspects.Aspect)

Example 4 with AspectList

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

the class EssentiaHelper method getEssentia.

public static boolean getEssentia(IInventory inv, int slot, Aspect aspect) {
    ItemStack stack = inv.getStackInSlot(slot);
    if (!InvTools.isEmpty(stack) && stack.getItem() instanceof IEssentiaContainerItem && "item.BlockJarFilledItem".equals(stack.getUnlocalizedName())) {
        IEssentiaContainerItem jar = (IEssentiaContainerItem) stack.getItem();
        AspectList aspects = jar.getAspects(stack);
        if (aspects.getAmount(aspect) > 0) {
            aspects.remove(aspect, 1);
            if (aspects.size() == 0) {
                ItemStack emptyJar = ThaumcraftPlugin.BLOCKS.get("jar");
                inv.setInventorySlotContents(slot, emptyJar);
            } else
                jar.setAspects(stack, aspects);
            return true;
        }
    }
    return false;
}
Also used : IEssentiaContainerItem(thaumcraft.api.aspects.IEssentiaContainerItem) AspectList(thaumcraft.api.aspects.AspectList) ItemStack(net.minecraft.item.ItemStack)

Example 5 with AspectList

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

the class ThaumcraftPlugin method registerAspects.

public static void registerAspects() {
    try {
        AspectList worldspikeAspects = new AspectList().add(Aspect.ELDRITCH, 4).add(Aspect.ORDER, 4).add(Aspect.AURA, 2).add(Aspect.DESIRE, 2);
        AspectList steamAspects = new AspectList().add(Aspect.WATER, 3).add(Aspect.MECHANISM, 2).add(Aspect.FIRE, 3);
        AspectList tankAspects = new AspectList().add(Aspect.VOID, 4).add(Aspect.WATER, 4);
        addBrickAspects(BrickTheme.ABYSSAL, Aspect.DARKNESS);
        addBrickAspects(BrickTheme.BLEACHEDBONE, Aspect.DEATH);
        addBrickAspects(BrickTheme.BLOODSTAINED, Aspect.LIFE);
        addBrickAspects(BrickTheme.FROSTBOUND, Aspect.COLD);
        addBrickAspects(BrickTheme.INFERNAL, 2, Aspect.FIRE, Aspect.SOUL);
        addBrickAspects(BrickTheme.NETHER, Aspect.FIRE);
        addBrickAspects(BrickTheme.QUARRIED, Aspect.LIGHT);
        addBrickAspects(BrickTheme.SANDY, Aspect.EARTH);
        addItemAspect(EnumGeneric.STONE_ABYSSAL.getStack(), new AspectList().add(Aspect.EARTH, 4).add(Aspect.DARKNESS, 2));
        addItemAspect(EnumGeneric.STONE_QUARRIED.getStack(), new AspectList().add(Aspect.EARTH, 4).add(Aspect.LIGHT, 2));
        addItemAspect(EnumGeneric.CRUSHED_OBSIDIAN.getStack(), copyAspects(Blocks.OBSIDIAN).remove(Aspect.EARTH, 1).add(Aspect.ENTROPY, 1).add(Aspect.ELDRITCH, 1));
        addItemAspect(EnumGeneric.BLOCK_CONCRETE.getStack(), new AspectList().add(Aspect.EARTH, 3).add(Aspect.METAL, 1));
        addItemAspect(EnumGeneric.BLOCK_CREOSOTE.getStack(), new AspectList().add(Aspect.PLANT, 3).add(Aspect.ORDER, 1));
        addItemAspect(EnumOre.DARK_DIAMOND.getStack(), copyAspects(Blocks.DIAMOND_ORE).add(Aspect.DARKNESS, 1));
        addItemAspect(EnumOre.DARK_EMERALD.getStack(), copyAspects(Blocks.EMERALD_ORE).add(Aspect.DARKNESS, 1));
        addItemAspect(EnumOre.DARK_LAPIS.getStack(), copyAspects(Blocks.LAPIS_ORE).add(Aspect.DARKNESS, 1));
        addItemAspect(EnumOre.SULFUR.getStack(), new AspectList().add(Aspect.EARTH, 1).add(Aspect.FIRE, 3));
        addItemAspect(EnumOre.SALTPETER.getStack(), new AspectList().add(Aspect.EARTH, 1).add(Aspect.AIR, 3));
        addItemAspect(EnumOreMagic.FIRESTONE.getStack(), new AspectList().add(Aspect.EARTH, 1).add(Aspect.FIRE, 6).add(Aspect.ENTROPY, 1));
        addItemAspect(RailcraftItems.DUST.getStack(ItemDust.EnumDust.SULFUR), new AspectList().add(Aspect.ENTROPY, 1).add(Aspect.FIRE, 3));
        addItemAspect(RailcraftItems.DUST.getStack(ItemDust.EnumDust.SALTPETER), new AspectList().add(Aspect.ENTROPY, 1).add(Aspect.AIR, 3));
        addItemAspect(RailcraftItems.DUST.getStack(ItemDust.EnumDust.CHARCOAL), new AspectList().add(Aspect.ENTROPY, 1).add(Aspect.FIRE, 2));
        addItemAspect(RailcraftItems.DUST.getStack(ItemDust.EnumDust.OBSIDIAN), copyAspects(Blocks.OBSIDIAN).remove(Aspect.EARTH, 2).add(Aspect.ENTROPY, 1));
        addItemAspect(RailcraftItems.REBAR.getStack(), new AspectList().add(Aspect.METAL, 1));
        addItemAspect(RailcraftItems.RAIL.getStack(1, EnumRail.STANDARD), new AspectList().add(Aspect.METAL, 1));
        addItemAspect(RailcraftItems.RAIL.getStack(1, EnumRail.REINFORCED), new AspectList().add(Aspect.METAL, 1).add(Aspect.ORDER, 1));
        addItemAspect(RailcraftItems.RAIL.getStack(1, EnumRail.WOOD), new AspectList().add(Aspect.PLANT, 1));
        addItemAspect(RailcraftItems.RAIL.getStack(1, EnumRail.ADVANCED), new AspectList().add(Aspect.METAL, 1).add(Aspect.MECHANISM, 1));
        addItemAspect(RailcraftItems.RAIL.getStack(1, EnumRail.SPEED), new AspectList().add(Aspect.METAL, 1).add(Aspect.MOTION, 1));
        addItemAspect(RailcraftItems.TIE.getStack(1, EnumTie.WOOD), new AspectList().add(Aspect.PLANT, 3).add(Aspect.ORDER, 1));
        addItemAspect(RailcraftItems.TIE.getStack(1, EnumTie.STONE), new AspectList().add(Aspect.EARTH, 3).add(Aspect.METAL, 1));
        addItemAspect(RailcraftItems.COKE.getStack(), new AspectList().add(Aspect.FIRE, 4).add(Aspect.ENERGY, 4));
        addItemAspect(RailcraftItems.PLATE.getStack(1, Metal.IRON), new AspectList().add(Aspect.METAL, 4));
        addItemAspect(RailcraftItems.PLATE.getStack(1, Metal.STEEL), new AspectList().add(Aspect.METAL, 3).add(Aspect.ORDER, 1));
        addItemAspect(RailcraftItems.PLATE.getStack(1, Metal.TIN), new AspectList().add(Aspect.METAL, 3));
        addItemAspect(RailcraftItems.GEAR.getStack(EnumGear.BRASS), new AspectList().add(Aspect.METAL, 4).add(Aspect.ORDER, 1).add(Aspect.MECHANISM, 2).add(Aspect.DESIRE, 2));
        addItemAspect(RailcraftItems.GEAR.getStack(EnumGear.BUSHING), new AspectList().add(Aspect.METAL, 1).add(Aspect.ORDER, 1).add(Aspect.MECHANISM, 1));
        addItemAspect(RailcraftItems.GEAR.getStack(EnumGear.IRON), new AspectList().add(Aspect.METAL, 4).add(Aspect.ORDER, 1).add(Aspect.MECHANISM, 4));
        addItemAspect(RailcraftItems.GEAR.getStack(EnumGear.STEEL), new AspectList().add(Aspect.METAL, 8).add(Aspect.ORDER, 2).add(Aspect.MECHANISM, 4));
        addItemAspect(EquipmentVariant.ROLLING_MACHINE_POWERED.getStack(), new AspectList().add(Aspect.CRAFT, 6).add(Aspect.MECHANISM, 2));
        addItemAspect(EnumMachineAlpha.ROCK_CRUSHER.getStack(), new AspectList().add(Aspect.CRAFT, 2).add(Aspect.MECHANISM, 4).add(Aspect.EARTH, 4).add(Aspect.EARTH, 4));
        addItemAspect(EquipmentVariant.FEED_STATION.getStack(), new AspectList().add(Aspect.PLANT, 4).add(Aspect.BEAST, 4).add(Aspect.MECHANISM, 2));
        addItemAspect(EquipmentVariant.SMOKER.getStack(), new AspectList().add(Aspect.FIRE, 4).add(Aspect.AIR, 4).add(Aspect.MECHANISM, 2));
        addItemAspect(EquipmentVariant.SMOKER.getStack(), new AspectList().add(Aspect.FIRE, 4).add(Aspect.AIR, 4).add(Aspect.MECHANISM, 2));
        addItemAspect(EnumMachineAlpha.STEAM_TRAP_MANUAL.getStack(), steamAspects.copy().add(Aspect.TRAP, 4));
        addItemAspect(EnumMachineAlpha.STEAM_TRAP_AUTO.getStack(), steamAspects.copy().add(Aspect.TRAP, 4).add(Aspect.MIND, 2));
        addItemAspect(EnumMachineAlpha.STEAM_OVEN.getStack(), steamAspects.copy().add(Aspect.FIRE, 3));
        addItemAspect(EnumMachineAlpha.TURBINE.getStack(), steamAspects.copy().add(Aspect.ENERGY, 4));
        addItemAspect(WorldspikeVariant.ADMIN.getStack(), worldspikeAspects);
        addItemAspect(WorldspikeVariant.PERSONAL.getStack(), worldspikeAspects);
        addItemAspect(WorldspikeVariant.STANDARD.getStack(), worldspikeAspects);
        addItemAspect(RailcraftBlocks.WORLDSPIKE_POINT.getStack(), worldspikeAspects);
        addItemAspect(EnumMachineBeta.BOILER_FIREBOX_SOLID.getStack(), steamAspects.copy().add(Aspect.ENERGY, 2));
        addItemAspect(EnumMachineBeta.BOILER_FIREBOX_FLUID.getStack(), steamAspects.copy().add(Aspect.ENERGY, 2));
        addItemAspect(EnumMachineBeta.BOILER_TANK_LOW_PRESSURE.getStack(), steamAspects.copy().add(Aspect.ENERGY, 2));
        addItemAspect(EnumMachineBeta.BOILER_TANK_HIGH_PRESSURE.getStack(), steamAspects.copy().add(Aspect.ENERGY, 2));
        addItemAspect(EnumMachineBeta.ENGINE_STEAM_HOBBY.getStack(), steamAspects.copy().add(Aspect.ENERGY, 4));
        addItemAspect(EnumMachineBeta.ENGINE_STEAM_LOW.getStack(), steamAspects.copy().add(Aspect.ENERGY, 4));
        addItemAspect(EnumMachineBeta.ENGINE_STEAM_HIGH.getStack(), steamAspects.copy().add(Aspect.ENERGY, 4));
        addItemAspect(EnumMachineAlpha.TANK_WATER.getStack(), tankAspects.copy().add(Aspect.PLANT, 2).add(Aspect.WATER, 2));
        AspectList ironTankAspects = tankAspects.copy().add(Aspect.METAL, 2);
        addItemAspect(EnumMachineBeta.TANK_IRON_GAUGE.getStack(), ironTankAspects);
        addItemAspect(EnumMachineBeta.TANK_IRON_VALVE.getStack(), ironTankAspects);
        addItemAspect(EnumMachineBeta.TANK_IRON_WALL.getStack(), ironTankAspects);
        addItemAspect(EnumMachineBeta.TANK_STEEL_GAUGE.getStack(), ironTankAspects);
        addItemAspect(EnumMachineBeta.TANK_STEEL_VALVE.getStack(), ironTankAspects);
        addItemAspect(EnumMachineBeta.TANK_STEEL_WALL.getStack(), ironTankAspects);
        AspectList detectorAspects = new AspectList().add(Aspect.SENSES, 4).add(Aspect.MECHANISM, 4);
        for (EnumDetector detector : EnumDetector.VALUES) {
            addItemAspect(detector.getStack(), detectorAspects);
        }
        AspectList glassAspects = new AspectList().add(Aspect.CRYSTAL, 4).add(Aspect.METAL, 1);
        for (EnumColor color : EnumColor.VALUES) {
            addItemAspect(RailcraftBlocks.GLASS.getStack(color), glassAspects);
        }
        addItemAspect(RailcraftBlocks.ANVIL_STEEL.getStack(), new AspectList().add(Aspect.CRAFT, 4).add(Aspect.EXCHANGE, 2).add(Aspect.METAL, 4).add(Aspect.ORDER, 2));
        addCartAspect(RailcraftCarts.LOCO_STEAM_SOLID, steamAspects.copy().add(Aspect.MOTION, 2).add(Aspect.MECHANISM, 4));
        addCartAspect(RailcraftCarts.LOCO_ELECTRIC, new AspectList().add(Aspect.FLUX, 6).add(Aspect.MECHANISM, 6).add(Aspect.MOTION, 2));
        addCartAspect(RailcraftCarts.PUMPKIN, new AspectList(new ItemStack(Blocks.PUMPKIN)).add(Aspect.MOTION, 2).add(Aspect.ENTROPY, 6));
        addCartAspect(RailcraftCarts.WORLDSPIKE_STANDARD, worldspikeAspects.copy().add(Aspect.MOTION, 2));
        addCartAspect(RailcraftCarts.WORLDSPIKE_ADMIN, worldspikeAspects.copy().add(Aspect.MOTION, 2));
        addCartAspect(RailcraftCarts.WORLDSPIKE_PERSONAL, worldspikeAspects.copy().add(Aspect.MOTION, 2));
        addItemAspect(RailcraftItems.GOGGLES.getStack(), new AspectList().add(Aspect.AURA, 4).add(Aspect.SENSES, 4));
        addItemAspect(RailcraftItems.FIRESTONE_RAW.getStack(), new AspectList().add(Aspect.FIRE, 6).add(Aspect.CRYSTAL, 2).add(Aspect.ENTROPY, 4));
        addItemAspect(RailcraftItems.FIRESTONE_CUT.getStack(), new AspectList().add(Aspect.FIRE, 6).add(Aspect.CRYSTAL, 2).add(Aspect.ENTROPY, 2).add(Aspect.ORDER, 2));
        addItemAspect(ItemFirestoneRefined.getItemCharged(), new AspectList().add(Aspect.FIRE, 6).add(Aspect.CRYSTAL, 2).add(Aspect.ORDER, 4));
        addItemAspect(ItemFirestoneCracked.getItemCharged(), new AspectList().add(Aspect.FIRE, 6).add(Aspect.CRYSTAL, 2).add(Aspect.ENTROPY, 4));
    } catch (Throwable error) {
        Game.logErrorAPI("Thaumcraft", error, ThaumcraftApi.class);
    }
}
Also used : EnumColor(mods.railcraft.common.plugins.color.EnumColor) AspectList(thaumcraft.api.aspects.AspectList) ThaumcraftApi(thaumcraft.api.ThaumcraftApi) EnumDetector(mods.railcraft.common.blocks.detector.EnumDetector) 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