@Override @ModDependent(ModList.THAUMCRAFT) public AspectList getAspects() { AspectList as = new AspectList(); as.add(Aspect.AURA, 400); Collection<Aspect> li = ChromaAspectManager.instance.getAspects(this.getColor(), true); for (Aspect a : li) { as.add(a, 400); } return as; }
/** Decomposes an Aspect down to its primal types. */ public static AspectList decompose(Aspect a) { AspectList al = new AspectList(); if (a.isPrimal()) { al.add(a, 1); } else { HashMap<Aspect, Integer> map = getAspectDecomposition(a); for (Aspect a2 : map.keySet()) { al.add(a2, map.get(a2)); } } return al; }
/** Decomposes an AspectList down to its primal types. */ public static AspectList decompose(AspectList complex) { AspectList al = new AspectList(); for (Aspect a : complex.aspects.keySet()) { int amt = complex.getAmount(a); if (a.isPrimal()) { al.add(a, amt); } else { HashMap<Aspect, Integer> map = getAspectDecomposition(a); for (Aspect a2 : map.keySet()) { al.add(a2, amt * map.get(a2)); } } } return al; }
public static void addRecipes() { int i = -2; String ref = FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT ? ChromaDescriptions.getParentPage() + "thaum.xml" : ""; for (TieredOres t : items.keySet()) { WandType wt = items.get(t); AspectList al = new AspectList(); int n = t == TieredOres.FOCAL ? 2 : 1; al.add(Aspect.ORDER, 20 * n); Aspect a = wt.aspects.get(0); al.add(a, 50 * n); Object[] recipe = {"AAA", "A A", 'A', wt.raw}; ShapedArcaneRecipe ir = ThaumcraftApi.addArcaneCraftingRecipe("", wt.item, al, recipe); String id = "CAP_TIEREDCAP_" + t.name(); String desc = "Novel caps"; MathExpression cost = new MathExpression() { @Override public double evaluate(double arg) throws ArithmeticException { return arg / 5D; } @Override public double getBaseValue() { return 0; } @Override public String toString() { return "/5"; } }; ReikaThaumHelper.addArcaneRecipeBookEntryViaXML( id, desc, "chromaticraft", ir, cost, 2, i, ChromatiCraft.class, ref); i++; } }
private static AspectList getAspectList(Object... aspects) { AspectList ot = new AspectList(); try { for (int i = 0; i < aspects.length; i += 2) { ot.add((Aspect) aspects[i], (Integer) aspects[i + 1]); } } catch (ClassCastException e) { DragonAPICore.logError( "Invalid parameters! Could not generate aspect list from " + Arrays.toString(aspects) + "!"); e.printStackTrace(); } return ot; }
/** * 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> * * @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); } }
public static void addArcaneRecipeBookEntryViaXML( String id, String desc, String category, IArcaneRecipe ir, MathExpression cost, int row, int col, Class root, String path) { ItemStack out = ir.getRecipeOutput(); AspectList aspects = new AspectList(); for (Aspect a : ir.getAspects().aspects.keySet()) { aspects.add(a, Math.max(1, (int) (cost.evaluate(ir.getAspects().getAmount(a))))); } String name = out.getDisplayName(); CustomThaumResearch res = new CustomThaumResearch(id, category, aspects, col, row, 0, out).setName(name); res.setDescription(desc); XMLResearch xml = new XMLResearch(id.toLowerCase(Locale.ENGLISH), root, path, ir, 2); res.setPages(xml.getPages()); res.registerResearchItem(); }
@Override protected void registerCrafting() { // Common items CommonDependantItems cdi = FeatureRegistry.instance().getCommonItems(); // My items IThEItems theItems = ThEApi.instance().items(); ItemStack EssentiaStorageComponent_1k = theItems.EssentiaStorageComponent_1k.getStack(); ItemStack EssentiaStorageComponent_4k = theItems.EssentiaStorageComponent_4k.getStack(); ItemStack EssentiaStorageComponent_16k = theItems.EssentiaStorageComponent_16k.getStack(); ItemStack EssentiaStorageComponent_64k = theItems.EssentiaStorageComponent_64k.getStack(); ItemStack EssentiaCell_Housing = theItems.EssentiaCell_Casing.getStack(); ItemStack EssentiaCell_1k = theItems.EssentiaCell_1k.getStack(); ItemStack EssentiaCell_4k = theItems.EssentiaCell_4k.getStack(); ItemStack EssentiaCell_16k = theItems.EssentiaCell_16k.getStack(); ItemStack EssentiaCell_64k = theItems.EssentiaCell_64k.getStack(); ItemStack EssentiaCellWorkbench = ThEApi.instance().blocks().EssentiaCellWorkbench.getStack(); // Item Groups ArrayList<ItemStack> GroupQuartz = new ArrayList<ItemStack>(3); GroupQuartz.add(cdi.CertusQuartz); GroupQuartz.add(cdi.ChargedCertusQuartz); GroupQuartz.add(cdi.PureCertusQuartz); // Housing =============================================== // Housing recipe Object[] recipeHousing = new Object[] { "WRW", "R R", "TTT", 'W', cdi.WardedGlass, 'R', cdi.RedstoneDust, 'T', cdi.ThaumiumIngot }; // Register Housing GameRegistry.addRecipe( RecipeRegistry.ITEM_STORAGE_HOUSING = new ShapedOreRecipe(EssentiaCell_Housing, false, recipeHousing)); // 1K ==================================================== // 1K Storage aspects AspectList aspects1KStorage = new AspectList(); aspects1KStorage.add(Aspect.FIRE, 3); aspects1KStorage.add(Aspect.ORDER, 1); // 1K Storage recipe Object[] recipe1KStorage = new Object[] { "EQ ", "QPQ", " QE", 'E', cdi.EtheralEssence, 'Q', cdi.CertusQuartz, 'P', cdi.LogicProcessor }; // 1K Cell recipe Object[] recipe1KCell = new Object[] { "WRW", "RCR", "TTT", 'W', cdi.WardedGlass, 'R', cdi.RedstoneDust, 'T', cdi.ThaumiumIngot, 'C', EssentiaStorageComponent_1k }; // Register 1K storage RecipeRegistry.ITEM_STORAGE_COMPONENT_1K = ThaumcraftApi.addArcaneCraftingRecipe( ResearchTypes.STORAGE.getKey(), EssentiaStorageComponent_1k, aspects1KStorage, recipe1KStorage); // Register 1K cell GameRegistry.addRecipe( RecipeRegistry.ITEM_STORAGE_CELL_1K_SHAPED = new ShapedOreRecipe(EssentiaCell_1k, false, recipe1KCell)); GameRegistry.addRecipe( RecipeRegistry.ITEM_STORAGE_CELL_1K_SHAPELESS = new ShapelessOreRecipe( EssentiaCell_1k, EssentiaStorageComponent_1k, EssentiaCell_Housing)); // Replace regular certus quartz with any of the certus quartz variants in the 1K storage // component this.replaceRecipeIngredientWithGroup( (ShapedArcaneRecipe) RecipeRegistry.ITEM_STORAGE_COMPONENT_1K, cdi.CertusQuartz, GroupQuartz); // 4K =================================================== // 4K Storage aspects AspectList aspects4KStorage = new AspectList(); aspects4KStorage.add(Aspect.FIRE, 3); aspects4KStorage.add(Aspect.ORDER, 2); // 4K Storage recipe Object[] recipe4KStorage = new Object[] { "EPE", "1G1", "E1E", 'E', cdi.EtheralEssence, '1', EssentiaStorageComponent_1k, 'P', cdi.CalculationProcessor, 'G', cdi.QuartzGlass }; // 4K Cell recipe Object[] recipe4KCell = new Object[] { "WRW", "RCR", "TTT", 'W', cdi.WardedGlass, 'R', cdi.RedstoneDust, 'T', cdi.ThaumiumIngot, 'C', EssentiaStorageComponent_4k }; // Register 4K storage RecipeRegistry.ITEM_STORAGE_COMPONENT_4K = ThaumcraftApi.addArcaneCraftingRecipe( ResearchTypes.STORAGE.getKey(), EssentiaStorageComponent_4k, aspects4KStorage, recipe4KStorage); // Register 4K cell GameRegistry.addRecipe( RecipeRegistry.ITEM_STORAGE_CELL_4K_SHAPED = new ShapedOreRecipe(EssentiaCell_4k, false, recipe4KCell)); GameRegistry.addRecipe( RecipeRegistry.ITEM_STORAGE_CELL_4K_SHAPELESS = new ShapelessOreRecipe( EssentiaCell_4k, EssentiaStorageComponent_4k, EssentiaCell_Housing)); // 16K =================================================== // 16K Storage aspects AspectList aspects16KStorage = new AspectList(); aspects16KStorage.add(Aspect.FIRE, 3); aspects16KStorage.add(Aspect.ORDER, 4); // 16K Storage recipe Object[] recipe16KStorage = new Object[] { "SPE", "4G4", "E4S", 'E', cdi.EtheralEssence, 'S', cdi.SalisMundus, '4', EssentiaStorageComponent_4k, 'P', cdi.EngineeringProcessor, 'G', cdi.QuartzGlass }; // 16K Cell recipe Object[] recipe16KCell = new Object[] { "WRW", "RCR", "TTT", 'W', cdi.WardedGlass, 'R', cdi.RedstoneDust, 'T', cdi.ThaumiumIngot, 'C', EssentiaStorageComponent_16k }; // Register 16K storage RecipeRegistry.ITEM_STORAGE_COMPONENT_16K = ThaumcraftApi.addArcaneCraftingRecipe( ResearchTypes.STORAGE.getKey(), EssentiaStorageComponent_16k, aspects16KStorage, recipe16KStorage); // Register 16K cell GameRegistry.addRecipe( RecipeRegistry.ITEM_STORAGE_CELL_16K_SHAPED = new ShapedOreRecipe(EssentiaCell_16k, false, recipe16KCell)); GameRegistry.addRecipe( RecipeRegistry.ITEM_STORAGE_CELL_16K_SHAPELESS = new ShapelessOreRecipe( EssentiaCell_16k, EssentiaStorageComponent_16k, EssentiaCell_Housing)); // 64K =================================================== // 64K Storage aspects AspectList aspects64KStorage = new AspectList(); aspects64KStorage.add(Aspect.FIRE, 3); aspects64KStorage.add(Aspect.ORDER, 8); // 64K Storage recipe Object[] recipe64KStorage = new Object[] { "SPS", "6G6", "S6S", 'S', cdi.SalisMundus, '6', EssentiaStorageComponent_16k, 'P', cdi.EngineeringProcessor, 'G', cdi.QuartzGlass }; // 64K Cell recipe Object[] recipe64KCell = new Object[] { "WRW", "RCR", "TTT", 'W', cdi.WardedGlass, 'R', cdi.RedstoneDust, 'T', cdi.ThaumiumIngot, 'C', EssentiaStorageComponent_64k }; // Register 64K storage RecipeRegistry.ITEM_STORAGE_COMPONENT_64K = ThaumcraftApi.addArcaneCraftingRecipe( ResearchTypes.STORAGE.getKey(), EssentiaStorageComponent_64k, aspects64KStorage, recipe64KStorage); // 64K Storage Cell GameRegistry.addRecipe( RecipeRegistry.ITEM_STORAGE_CELL_64K_SHAPED = new ShapedOreRecipe(EssentiaCell_64k, false, recipe64KCell)); GameRegistry.addRecipe( RecipeRegistry.ITEM_STORAGE_CELL_64K_SHAPELESS = new ShapelessOreRecipe( EssentiaCell_64k, EssentiaStorageComponent_64k, EssentiaCell_Housing)); // Workbench GameRegistry.addRecipe( RecipeRegistry.BLOCK_CELL_WORKBENCH = new ShapelessOreRecipe( EssentiaCellWorkbench, EssentiaStorageComponent_1k, cdi.MECellWorkbench)); }
@Override protected void registerResearch() { // Set the research aspects AspectList storageAspectList = new AspectList(); storageAspectList.add(Aspect.VOID, 5); storageAspectList.add(Aspect.ENERGY, 5); storageAspectList.add(Aspect.CRYSTAL, 3); storageAspectList.add(Aspect.METAL, 3); // Set the icon ItemStack storageIcon = ThEApi.instance().items().EssentiaCell_64k.getStack(); // Get the component recipes IArcaneRecipe[] storageComponentRecipes = new IArcaneRecipe[] { RecipeRegistry.ITEM_STORAGE_COMPONENT_4K, RecipeRegistry.ITEM_STORAGE_COMPONENT_16K, RecipeRegistry.ITEM_STORAGE_COMPONENT_64K }; // Get the cell shaped recipes IRecipe[] storageCellsShaped = new IRecipe[] { RecipeRegistry.ITEM_STORAGE_CELL_1K_SHAPED, RecipeRegistry.ITEM_STORAGE_CELL_4K_SHAPED, RecipeRegistry.ITEM_STORAGE_CELL_16K_SHAPED, RecipeRegistry.ITEM_STORAGE_CELL_64K_SHAPED }; // Get the cell shapeless recipes IRecipe[] storageCellsShapeless = new IRecipe[] { RecipeRegistry.ITEM_STORAGE_CELL_1K_SHAPELESS, RecipeRegistry.ITEM_STORAGE_CELL_4K_SHAPELESS, RecipeRegistry.ITEM_STORAGE_CELL_16K_SHAPELESS, RecipeRegistry.ITEM_STORAGE_CELL_64K_SHAPELESS }; // Set the pages ResearchPage[] storagePages = new ResearchPage[] { new ResearchPage(ResearchTypes.STORAGE.getPageName(1)), new ResearchPage(ResearchTypes.STORAGE.getPageName(2)), new ResearchPage(RecipeRegistry.ITEM_STORAGE_COMPONENT_1K), new ResearchPage(storageComponentRecipes), new ResearchPage(RecipeRegistry.ITEM_STORAGE_HOUSING), new ResearchPage(storageCellsShaped), new ResearchPage(storageCellsShapeless), new ResearchPage(RecipeRegistry.BLOCK_CELL_WORKBENCH) }; String[] storageParents; // Is the warded stone research enabled? if (Config.wardedStone) { storageParents = new String[3]; storageParents[2] = PseudoResearchTypes.WARDED.getKey(); } else { storageParents = new String[2]; } storageParents[0] = this.getFirstValidParentKey(false); storageParents[1] = PseudoResearchTypes.DISTILESSENTIA.getKey(); // Create the storage research ResearchTypes.STORAGE.createResearchItem( storageAspectList, ResearchRegistry.COMPLEXITY_MEDIUM, storageIcon, storagePages); ResearchTypes.STORAGE.researchItem.setParents(storageParents); ResearchTypes.STORAGE.researchItem.setParentsHidden("DISTILESSENTIA"); ResearchTypes.STORAGE.researchItem.registerResearchItem(); }
private static void registerItemAspects() { AspectList oldAspects = ThaumcraftCraftingManager.getObjectTags(new ItemStack(RegisteredBlocks.blockStoneMachine)); ThaumcraftApi.registerObjectTag( new ItemStack(Item.getItemFromBlock(RegisteredBlocks.blockStoneMachine)), new int[] {11, 15}, new AspectList()); ThaumcraftApi.registerObjectTag( new ItemStack(Item.getItemFromBlock(RegisteredBlocks.blockStoneMachine)), new int[] {0}, oldAspects); AspectList pylon = new AspectList() .add(Aspect.WATER, 10) .add(Aspect.MAGIC, 12) .add(Aspect.VOID, 4) .add(Aspect.MECHANISM, 4); ThaumcraftApi.registerObjectTag( new ItemStack(Item.getItemFromBlock(RegisteredBlocks.blockAuraPylon)), new int[] {0}, pylon); pylon = new AspectList() .add(Aspect.FIRE, 10) .add(Aspect.AURA, 12) .add(Aspect.MAGIC, 8) .add(Aspect.LIGHT, 4) .add(Aspect.MECHANISM, 4); ThaumcraftApi.registerObjectTag( new ItemStack(Item.getItemFromBlock(RegisteredBlocks.blockAuraPylon)), new int[] {1}, pylon); AspectList packager = new AspectList() .add(Aspect.TREE, 10) .add(Aspect.MECHANISM, 8) .add(Aspect.CRAFT, 8) .add(Aspect.AURA, 12); ThaumcraftApi.registerObjectTag( new ItemStack(Item.getItemFromBlock(RegisteredBlocks.blockStoneMachine)), new int[] {4}, packager); AspectList aspect = new AspectList(); aspect.add(Aspect.MAGIC, 6).add(Aspect.AURA, 12).add(Aspect.ELDRITCH, 4).add(Aspect.VOID, 10); ThaumcraftApi.registerObjectTag( new ItemStack(RegisteredItems.itemAuraCore), new int[] {0}, aspect.copy()); ThaumcraftApi.registerObjectTag( new ItemStack(RegisteredItems.itemAuraCore), new int[] {1}, aspect.copy().add(Aspect.AIR, 26)); ThaumcraftApi.registerObjectTag( new ItemStack(RegisteredItems.itemAuraCore), new int[] {2}, aspect.copy().add(Aspect.FIRE, 26)); ThaumcraftApi.registerObjectTag( new ItemStack(RegisteredItems.itemAuraCore), new int[] {3}, aspect.copy().add(Aspect.WATER, 26)); ThaumcraftApi.registerObjectTag( new ItemStack(RegisteredItems.itemAuraCore), new int[] {4}, aspect.copy().add(Aspect.EARTH, 26)); ThaumcraftApi.registerObjectTag( new ItemStack(RegisteredItems.itemAuraCore), new int[] {5}, aspect.copy().add(Aspect.ORDER, 26)); ThaumcraftApi.registerObjectTag( new ItemStack(RegisteredItems.itemAuraCore), new int[] {6}, aspect.copy().add(Aspect.ENTROPY, 26)); ThaumcraftApi.registerObjectTag( new ItemStack(RegisteredItems.itemPackage, 1, 0), new AspectList().add(Aspect.CLOTH, 2).add(Aspect.BEAST, 2).add(Aspect.ARMOR, 1)); ThaumcraftApi.registerObjectTag( new ItemStack(RegisteredItems.itemPackage, 1, 1), new AspectList().add(Aspect.CLOTH, 4)); ThaumcraftApi.registerObjectTag( new ItemStack(RegisteredItems.itemFakeLootbag, 1, 0), new AspectList().add(Aspect.CLOTH, 2).add(Aspect.BEAST, 2).add(Aspect.ARMOR, 1)); ThaumcraftApi.registerObjectTag( new ItemStack(RegisteredItems.itemFakeLootbag, 1, 1), new AspectList().add(Aspect.CLOTH, 4)); ThaumcraftApi.registerObjectTag( new ItemStack(RegisteredBlocks.blockKnowledgeBook), new AspectList() .add(Aspect.MIND, 8) .add(Aspect.MECHANISM, 4) .add(Aspect.MAGIC, 6) .add(Aspect.ORDER, 4)); }