@Override public void onUsingFocusTick( ItemStack paramItemStack, EntityPlayer paramEntityPlayer, int paramInt) { if (paramEntityPlayer.worldObj.isRemote) return; ItemWandCasting wand = (ItemWandCasting) paramItemStack.getItem(); AspectList aspects = wand.getAllVis(paramItemStack); Aspect aspectToAdd = null; int takes = 0; while (aspectToAdd == null) { lastGiven = lastGiven == 5 ? 0 : lastGiven + 1; Aspect aspect = Aspect.getPrimalAspects().get(lastGiven); if (aspects.getAmount(aspect) < wand.getMaxVis(paramItemStack)) aspectToAdd = aspect; ++takes; if (takes == 7) return; } int xpUse = getXpUse(paramItemStack); if (paramEntityPlayer.experienceTotal >= xpUse) { ExperienceHelper.drainPlayerXP(paramEntityPlayer, xpUse); wand.storeVis(paramItemStack, aspectToAdd, wand.getVis(paramItemStack, aspectToAdd) + 500); } }
protected void addVisCostTooltip( AspectList cost, ItemStack stack, EntityPlayer player, List list, boolean par4) { for (Aspect aspect : cost.getAspectsSorted()) { float amount = cost.getAmount(aspect) / 100.0F; list.add( " " + '\u00a7' + aspect.getChatcolor() + aspect.getName() + '\u00a7' + "r x " + amount); } }
@Override public void updateEntity() { ItemStack jar = getStackInSlot(0); if (!worldObj.isRemote && jar != null && jar.getItem() instanceof ItemJarFilled) { ItemJarFilled item = (ItemJarFilled) jar.getItem(); AspectList aspectList = item.getAspects(jar); if (aspectList != null && aspectList.size() == 1) { Aspect aspect = aspectList.getAspects()[0]; TileEntity tile = worldObj.getBlockTileEntity(xCoord, yCoord - 1, zCoord); if (tile != null && tile instanceof TileEntityHopper) { TileEntity tile1 = getHopperFacing(tile.xCoord, tile.yCoord, tile.zCoord, tile.getBlockMetadata()); if (tile1 instanceof TileJarFillable) { TileJarFillable jar1 = (TileJarFillable) tile1; AspectList aspectList1 = jar1.getAspects(); if (aspectList1 != null && aspectList1.size() == 0 || aspectList1.getAspects()[0] == aspect && aspectList1.getAmount(aspectList1.getAspects()[0]) < 64) { jar1.addToContainer(aspect, 1); item.setAspects(jar, aspectList.remove(aspect, 1)); } } } } } }
@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; }
public static void addAspects(ItemStack is, AspectList aspects) { AspectList has = ThaumcraftApi.objectTags.get(Arrays.asList(is.getItem(), is.getItemDamage())); if (has != null) { for (Aspect as : has.aspects.keySet()) { aspects.merge(as, has.getAmount(as)); } } clearNullAspects(aspects); ThaumcraftApi.registerObjectTag(is, new int[] {is.getItemDamage()}, aspects); DragonAPICore.log("Registering " + is + " aspects " + aspectsToString(aspects)); }
/** * @return the aspect aspects ordinal with the highest value. Used to determine scroll color and * similar things */ public Aspect getResearchPrimaryTag() { Aspect aspect = null; int highest = 0; if (tags != null) { for (Aspect tag : tags.getAspects()) { if (tags.getAmount(tag) > highest) { aspect = tag; highest = tags.getAmount(tag); } ; } } return aspect; }
@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); } } }
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; }
/** 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; }
@Override public ItemStack onFocusRightClick( ItemStack itemstack, World world, EntityPlayer player, MovingObjectPosition mop) { player.swingItem(); if (mop != null && ThaumcraftApiHelper.consumeVisFromWand(itemstack, player, visCost.copy(), true, false)) { int x = mop.blockX; int y = mop.blockY; int z = mop.blockZ; switch (mop.sideHit) { case (0): { y--; break; } case (1): { y++; break; } case (2): { z--; break; } case (3): { z++; break; } case (4): { x--; break; } case (5): { x++; break; } } if (world.getBlock(x, y, z).isReplaceable(world, x, y, z) || world.isAirBlock(x, y, z)) { ItemStack focusStack = ((ItemWandCasting) itemstack.getItem()).getFocusItem(itemstack); world.setBlock(x, y, z, TCBlocks.nitorColour); TileColouredNitor te = (TileColouredNitor) world.getTileEntity(x, y, z); te.setColour(getColour(focusStack)); world.playSoundEffect( mop.blockX + 0.5D, mop.blockY + 0.5D, mop.blockZ + 0.5D, "thaumcraft:zap", 0.25F, 1.0F); } } return itemstack; }
/** Contains a helper function to avoid overwriting existing aspects. */ public static void addAspects(ItemStack is, Object... aspects) { if (aspects.length % 2 != 0) { DragonAPICore.logError( "Could not add aspects to " + is + ": You must specify a level for every aspect!"); ReikaJavaLibrary.dumpStack(); return; } AspectList has = ThaumcraftApi.objectTags.get(Arrays.asList(is.getItem(), is.getItemDamage())); AspectList ot = getAspectList(aspects); if (has != null) { for (Aspect as : has.aspects.keySet()) { ot.merge(as, has.getAmount(as)); } } clearNullAspects(ot); ThaumcraftApi.registerObjectTag(is, ot); DragonAPICore.log("Registering " + is + " aspects " + aspectsToString(ot)); }
public static String aspectsToString(AspectList al) { StringBuilder sb = new StringBuilder(); sb.append("{"); for (Aspect a : al.aspects.keySet()) { int amt = al.getAmount(a); sb.append(a.getTag() + "=" + amt); sb.append(", "); } sb.append("}"); return sb.toString(); }
/** * 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 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 void addAspect( EntityPlayer player, ScanResult scan, double chanceToIncrease, double increaseMult) { Thaumcraft.proxy .getResearchManager() .completeScannedObject( player, "@" + ScanManager.generateItemHash(Item.getItemById(scan.id), scan.meta)); AspectList aspects = ThaumcraftCraftingManager.getObjectTags( new ItemStack(Item.getItemById(scan.id), 1, scan.meta)); if (aspects != null) { PlayerKnowledge pk = Thaumcraft.proxy.getPlayerKnowledge(); for (Aspect aspect : aspects.getAspects()) { if (pk.hasDiscoveredParentAspects(player.getCommandSenderName(), aspect)) { int amt = aspects.getAmount(aspect); if (chanceToIncrease > 0d && player.getEntityWorld().rand.nextDouble() < chanceToIncrease) amt = MathHelper.ceiling_double_int((double) amt * increaseMult); ScanManager.checkAndSyncAspectKnowledge(player, aspect, amt); } } } }
@Override @ModDependent(ModList.THAUMCRAFT) public void onUsingWandTick(ItemStack wandstack, EntityPlayer player, int count) { if (!worldObj.isRemote && this.canConduct() && player.ticksExisted % 5 == 0) { if (!ChromaOptions.HARDTHAUM.getState() || ReikaThaumHelper.isResearchComplete(player, "NODETAPPER2")) { AspectList al = ReikaThaumHelper.decompose(this.getAspects()); for (Aspect a : al.aspects.keySet()) { int amt = 2; if (ReikaThaumHelper.isResearchComplete(player, "NODETAPPER1")) amt *= 2; if (ReikaThaumHelper.isResearchComplete(player, "NODETAPPER2")) amt *= 2; amt = Math.min(amt, al.getAmount(a)); amt = Math.min(amt, ReikaThaumHelper.getWandSpaceFor(wandstack, a)); int ret = ReikaThaumHelper.addVisToWand(wandstack, a, amt); int added = amt - ret; if (added > 0) { this.drain(color, Math.min(energy, energy - added * 48)); } } } } }
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(); }
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)); }
public boolean updateBehavior(boolean needUpdate) { if (fixedNode != null && owningNode.ticksExisted % 3 == 0) { if (owningNode.getWorldObj().getBlock(fixedNode.xCoord, fixedNode.yCoord, fixedNode.zCoord) != RegisteredBlocks.blockNode || owningNode .getWorldObj() .getTileEntity(fixedNode.xCoord, fixedNode.yCoord, fixedNode.zCoord) == null || fixedNode.isInvalid()) { fixedNode = null; return needUpdate; } AspectList currentAspects = fixedNode.getAspects(); AspectList baseAspects = fixedNode.getAspectsBase(); if (baseAspects.getAspects().length == 0) { int x = fixedNode.xCoord; int y = fixedNode.yCoord; int z = fixedNode.zCoord; removeFixedNode(x, y, z); return needUpdate; } Aspect a = baseAspects .getAspects()[owningNode.getWorldObj().rand.nextInt(baseAspects.getAspects().length)]; if (baseAspects.getAmount(a) > 0) { if (baseAspects.reduce(a, 1)) { World world = owningNode.getWorldObj(); int fx = fixedNode.xCoord; int fy = fixedNode.yCoord; int fz = fixedNode.zCoord; int ox = owningNode.xCoord; int oy = owningNode.yCoord; int oz = owningNode.zCoord; currentAspects.reduce(a, 1); ResearchHelper.distributeResearch( Gadomancy.MODID.toUpperCase() + ".GROWING_ATTACK", owningNode.getWorldObj(), owningNode.xCoord, owningNode.yCoord, owningNode.zCoord, 16); EntityAspectOrb aspectOrb = new EntityAspectOrb(world, fx + 0.5D, fy + 0.5D, fz + 0.5D, a, 1); Vec3 dir = Vec3.createVectorHelper(fx + 0.5D, fy + 0.5D, fz + 0.5D) .subtract(Vec3.createVectorHelper(ox + 0.5D, oy + 0.5D, oz + 0.5D)) .normalize(); dir.addVector(randOffset(), randOffset(), randOffset()).normalize(); aspectOrb.setVelocity(dir.xCoord, dir.yCoord, dir.zCoord); fixedNode.getWorldObj().spawnEntityInWorld(aspectOrb); NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint( world.provider.dimensionId, ox + 0.5F, oy + 0.5F, oz + 0.5F, 32); PacketTCNodeBolt bolt = new PacketTCNodeBolt( ox + 0.5F, oy + 0.5F, oz + 0.5F, fx + 0.5F, fy + 0.5F, fz + 0.5F, 0, false); PacketHandler.INSTANCE.sendToAllAround(bolt, point); PacketAnimationAbsorb packet = new PacketAnimationAbsorb(ox, oy, oz, fx, fy, fz, 7); PacketHandler.INSTANCE.sendToAllAround(packet, point); world.markBlockForUpdate(fx, fy, fz); fixedNode.markDirty(); needUpdate = true; } else { if (baseAspects.size() <= 1) { int x = fixedNode.xCoord; int y = fixedNode.yCoord; int z = fixedNode.zCoord; removeFixedNode(x, y, z); needUpdate = true; } baseAspects.remove(a); currentAspects.remove(a); return needUpdate; } } else { if (baseAspects.size() <= 1) { int x = fixedNode.xCoord; int y = fixedNode.yCoord; int z = fixedNode.zCoord; removeFixedNode(x, y, z); needUpdate = true; } baseAspects.remove(a); currentAspects.remove(a); return needUpdate; } } return needUpdate; }
@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 public AspectList getVisCost(ItemStack focusStack) { return visCost.copy(); }
private static void setupItemAspects() { ItemStack item; AspectList list; ThaumcraftApi.registerObjectTag( new ItemStack(Items.clock), new AspectList(new ItemStack(Items.clock)).add((Aspect) aspectTime, 4)); ThaumcraftApi.registerObjectTag( new ItemStack(Items.repeater), new AspectList(new ItemStack(Items.repeater)).add((Aspect) aspectTime, 2)); list = new AspectList(new ItemStack(Blocks.log)); for (int i = 1; i <= 8; i++) { item = ItemInterface.getItemStack("log" + i); if (item != null) { ThaumcraftApi.registerObjectTag(item, list); } } list = new AspectList(new ItemStack(Blocks.planks)); for (int i = 1; i <= 2; i++) { item = ItemInterface.getItemStack("planks" + i); if (item != null) { ThaumcraftApi.registerObjectTag(item, list); } } list = new AspectList().add(Aspect.ORDER, 5).add(Aspect.ARMOR, 2).add(Aspect.BEAST, 1); item = new ItemStack(Config.fHiveBlock); ThaumcraftApi.registerObjectTag(item, list); ThaumcraftApi.registerObjectTag(new ItemStack(Config.hive), list); list = new AspectList().add(Aspect.LIGHT, 1); item = new ItemStack(BlockInterface.getBlock(ForestryHelper.Name, "candle")); ThaumcraftApi.registerObjectTag(item, new int[] {item.getItemDamage()}, list); list = new AspectList().add(Aspect.DARKNESS, 1); item = new ItemStack(BlockInterface.getBlock(ForestryHelper.Name, "stump")); ThaumcraftApi.registerObjectTag(item, new int[] {item.getItemDamage()}, list); list = new AspectList(new ItemStack(Blocks.glass)).add(Aspect.SENSES, 1); item = new ItemStack(BlockInterface.getBlock(ForestryHelper.Name, "glass")); ThaumcraftApi.registerObjectTag(item, list); list = new AspectList().add(Aspect.EARTH, 2).add(Aspect.WATER, 2); item = new ItemStack(BlockInterface.getBlock(ForestryHelper.Name, "soil")); ThaumcraftApi.registerObjectTag(item, new int[] {1}, list); list = new AspectList(new ItemStack(Blocks.leaves)); item = ItemInterface.getItemStack(ForestryHelper.Name, "candle"); ThaumcraftApi.registerObjectTag(item, new int[] {item.getItemDamage()}, list); list = new AspectList(new ItemStack(Blocks.sapling)); item = ItemInterface.getItemStack(ForestryHelper.Name, "candle"); ThaumcraftApi.registerObjectTag(item, list); list = new AspectList() /* .add(Aspect.SEED, 1) */.add(Aspect.PLANT, 1); item = ItemInterface.getItemStack(ForestryHelper.Name, "candle"); ThaumcraftApi.registerObjectTag(item, list); list = new AspectList().add(Aspect.CRYSTAL, 1).add(Aspect.EARTH, 2); item = ItemInterface.getItemStack(ForestryHelper.Name, "candle"); ThaumcraftApi.registerObjectTag( new ItemStack(item.getItem(), 1, ForestryHelper.BlockResource.APATITE.ordinal()), list.copy()); item = ItemInterface.getItemStack(ForestryHelper.Name, "apatite"); ThaumcraftApi.registerObjectTag( new ItemStack(item.getItem(), 1, item.getItemDamage()), list.copy().add(Aspect.CRYSTAL, 2)); list = new AspectList().add(Aspect.MOTION, 2).add(Aspect.FLIGHT, 1); item = ItemInterface.getItemStack("beeDroneGE"); ThaumcraftApi.registerObjectTag(item, list); list = list.copy().add(Aspect.GREED, 2).add(Aspect.EXCHANGE, 1); item = ItemInterface.getItemStack("beePrincessGE"); ThaumcraftApi.registerObjectTag(item, list); item = ItemInterface.getItemStack("beeQueenGE"); ThaumcraftApi.registerObjectTag(item, list); list = new AspectList().add(Aspect.LIFE, 2).add(Aspect.EXCHANGE, 5); item = ItemInterface.getItemStack("beeLarvaeGE"); ThaumcraftApi.registerObjectTag(item, list); item = ItemInterface.getItemStack("scoop"); list = new AspectList(new ItemStack(item.getItem(), 1, 0)).add(Aspect.TOOL, 2); ThaumcraftApi.registerComplexObjectTag(item, list); item = ItemInterface.getItemStack("grafter"); list = new AspectList(new ItemStack(item.getItem(), 1, item.getItemDamage())).add(Aspect.TOOL, 2); ThaumcraftApi.registerComplexObjectTag(item, list); item = ItemInterface.getItemStack("grafterProven"); list = list.copy().add(Aspect.TOOL, 2).add(Aspect.EXCHANGE, 3); ThaumcraftApi.registerObjectTag(new ItemStack(item.getItem(), 1, item.getItemDamage()), list); list = new AspectList().add(Aspect.TRAP, 2); ThaumcraftApi.registerObjectTag("beeComb", list); list = new AspectList().add(Aspect.SLIME, 1); item = ItemInterface.getItemStack("propolis"); ThaumcraftApi.registerObjectTag( new ItemStack(item.getItem(), 1, ForestryHelper.Propolis.NORMAL.ordinal()), list); ThaumcraftApi.registerObjectTag( new ItemStack(item.getItem(), 1, ForestryHelper.Propolis.SILKY.ordinal()), list.copy().add(Aspect.SLIME, 2)); ThaumcraftApi.registerObjectTag( new ItemStack(item.getItem(), 1, ForestryHelper.Propolis.PULSATING.ordinal()), list.copy().add(Aspect.ELDRITCH, 2)); ThaumcraftApi.registerObjectTag( new ItemStack(Config.propolis, 1, PropolisType.UNSTABLE.ordinal()), list.copy().add(Aspect.ENTROPY, 1).add(Aspect.EXCHANGE, 1)); ThaumcraftApi.registerObjectTag( new ItemStack(Config.propolis, 1, PropolisType.AIR.ordinal()), list.copy().add(Aspect.AIR, 2)); ThaumcraftApi.registerObjectTag( new ItemStack(Config.propolis, 1, PropolisType.WATER.ordinal()), list.copy().add(Aspect.WATER, 2)); ThaumcraftApi.registerObjectTag( new ItemStack(Config.propolis, 1, PropolisType.FIRE.ordinal()), list.copy().add(Aspect.FIRE, 2)); ThaumcraftApi.registerObjectTag( new ItemStack(Config.propolis, 1, PropolisType.EARTH.ordinal()), list.copy().add(Aspect.EARTH, 2)); ThaumcraftApi.registerObjectTag( new ItemStack(Config.propolis, 1, PropolisType.ORDER.ordinal()), list.copy().add(Aspect.ORDER, 2)); ThaumcraftApi.registerObjectTag( new ItemStack(Config.propolis, 1, PropolisType.CHAOS.ordinal()), list.copy().add(Aspect.ENTROPY, 2)); list = new AspectList().add(Aspect.PLANT, 2); item = ItemInterface.getItemStack("pollen"); ThaumcraftApi.registerObjectTag( new ItemStack(item.getItem(), 1, ForestryHelper.Pollen.NORMAL.ordinal()), list); ThaumcraftApi.registerObjectTag( new ItemStack(item.getItem(), 1, ForestryHelper.Pollen.CRYSTALLINE.ordinal()), list.copy()); ThaumcraftApi.registerObjectTag( new ItemStack(Config.pollen, 1, PollenType.UNUSUAL.ordinal()), list.copy().add(Aspect.MAGIC, 2)); ThaumcraftApi.registerObjectTag( new ItemStack(Config.pollen, 1, PollenType.PHASED.ordinal()), list.copy().add((Aspect) aspectTime, 2)); list = new AspectList().add(Aspect.ORDER, 1); item = ItemInterface.getItemStack("beeswax"); ThaumcraftApi.registerObjectTag( item, new int[] {item.getItemDamage()}, list.copy().add(Aspect.ORDER, 2)); ThaumcraftApi.registerObjectTag( new ItemStack(Config.wax, 1, WaxType.MAGIC.ordinal()), list.copy().add(Aspect.MAGIC, 2)); ThaumcraftApi.registerObjectTag( new ItemStack(Config.wax, 1, WaxType.SOUL.ordinal()), list.copy().add(Aspect.SOUL, 2)); ThaumcraftApi.registerObjectTag( new ItemStack(Config.wax, 1, WaxType.AMNESIC.ordinal()), list.copy().add(Aspect.MIND, 2)); list = new AspectList().add(Aspect.EXCHANGE, 2).add(Aspect.LIFE, 2); item = ItemInterface.getItemStack("honeyDrop"); ThaumcraftApi.registerObjectTag(item, new int[] {item.getItemDamage()}, list); list = new AspectList().add(Aspect.LIFE, 2).add(Aspect.ENERGY, 2); item = ItemInterface.getItemStack("honeydew"); ThaumcraftApi.registerObjectTag(item, new int[] {item.getItemDamage()}, list); list = new AspectList().add(Aspect.GREED, 1).add(Aspect.LIFE, 4); item = ItemInterface.getItemStack("royalJelly"); ThaumcraftApi.registerObjectTag(item, new int[] {item.getItemDamage()}, list); list = new AspectList().add(Aspect.FIRE, 1).add(Aspect.TRAP, 2); item = ItemInterface.getItemStack("phosphor"); ThaumcraftApi.registerObjectTag(item, new int[] {item.getItemDamage()}, list); item = Config.miscResources.getStackForType(ResourceType.ESSENCE_FALSE_LIFE); ThaumcraftApi.registerObjectTag( item, new int[] {item.getItemDamage()}, new AspectList().add(Aspect.LIFE, 6)); item = Config.miscResources.getStackForType(ResourceType.ESSENCE_SHALLOW_GRAVE); ThaumcraftApi.registerObjectTag( item, new int[] {item.getItemDamage()}, new AspectList().add(Aspect.DEATH, 6)); item = Config.miscResources.getStackForType(ResourceType.ESSENCE_EVERLASTING_DURABILITY); ThaumcraftApi.registerObjectTag( item, new int[] {item.getItemDamage()}, new AspectList().add(Aspect.ARMOR, 6)); item = Config.miscResources.getStackForType(ResourceType.ESSENCE_LOST_TIME); ThaumcraftApi.registerObjectTag( item, new int[] {item.getItemDamage()}, new AspectList().add(Aspect.VOID, 6).add((Aspect) aspectTime, 8)); }
@SuppressWarnings("unchecked") public void updateEntity() { if (!this.worldObj.isRemote && tickTime == 0) MiscUtils.sendPacketToAllAround( worldObj, getDescriptionPacket(), xCoord, yCoord, zCoord, worldObj.provider.dimensionId, 16); int additionalStability = 0; if (hasAir) ++additionalStability; if (hasWater) ++additionalStability; if (hasFire) ++additionalStability; if (hasEarth) ++additionalStability; if (hasOrdo) ++additionalStability; if (hasEntropy) ++additionalStability; if (placerName == null || placerName.isEmpty() || placerName.contains("no placer")) return; List<Entity> entities = this.worldObj.getEntitiesWithinAABB( Entity.class, AxisAlignedBB.getBoundingBox( xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1)); if (!entities.isEmpty()) { Entity e = entities.get(0); if (e != null && !e.isDead) { if (e instanceof EntityItem) { if (additionalStability >= 6) { EntityItem itm = (EntityItem) e; ItemStack stk = itm.getEntityItem(); if (stk != null) { AspectList aspectsCompound = ThaumcraftCraftingManager.getObjectTags(stk); aspectsCompound = ThaumcraftCraftingManager.getBonusTags(stk, aspectsCompound); if (aspectsCompound != null && aspectsCompound.size() > 0) { ++tickTime; if (tickTime == 40) { tickTime = 0; --stk.stackSize; if (stk.stackSize <= 0) itm.setDead(); AspectList primals = ResearchManager.reduceToPrimals(aspectsCompound); Aspect a = null; if (this.worldObj.rand.nextInt(40) < primals.visSize()) a = primals .getAspects()[this.worldObj.rand.nextInt(primals.getAspects().length)]; if (!this.worldObj.isRemote && a != null) { EntityPlayerMP player = MinecraftServer.getServer() .getConfigurationManager() .func_152612_a(placerName); if (player != null) { double distance = player.getDistance(xCoord + 0.5D, yCoord, zCoord + 0.5D); if (additionalStability < 6) if (this.worldObj.rand.nextInt( MathHelper.floor_double( Math.max(1, (128 + additionalStability * 10) - distance))) == 0) TBUtils.addWarpToPlayer(EntityPlayerMP.class.cast(e), 1, 0); TBUtils.addAspectToKnowledgePool(player, a, (short) 1); } } } } Thaumcraft.proxy.blockRunes( worldObj, xCoord, yCoord + MathUtils.randomDouble(this.worldObj.rand) * 0.5D, zCoord, 1, 0.5F, 0.5F, 8, 0); return; } } } else { AspectList aspectsCompound = ScanManager.generateEntityAspects(e); if (aspectsCompound != null && aspectsCompound.size() > 0) { ++tickTime; tickTime += MathHelper.floor_double(additionalStability / 2); if (tickTime == 40) { tickTime = 0; e.attackEntityFrom(DamageSource.outOfWorld, 1); if (e instanceof EntityPlayerMP) { TBUtils.addWarpToPlayer(EntityPlayerMP.class.cast(e), 1, 0); } Aspect a = aspectsCompound.getAspects()[this.worldObj.rand.nextInt(aspectsCompound.size())]; if (!this.worldObj.isRemote) { EntityPlayerMP player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(placerName); if (player != null) { double distance = player.getDistance(xCoord + 0.5D, yCoord, zCoord + 0.5D); if (additionalStability < 6) if (this.worldObj.rand.nextInt( MathHelper.floor_double( Math.max(1, (128 + additionalStability * 10) - distance))) == 0) TBUtils.addWarpToPlayer(EntityPlayerMP.class.cast(e), 1, 0); TBUtils.addAspectToKnowledgePool(player, a, (short) 1); } } } Thaumcraft.proxy.blockRunes( worldObj, xCoord, yCoord + MathUtils.randomDouble(this.worldObj.rand) * 0.5D, zCoord, 1, 0.5F, 0.5F, 8, 0); return; } } } } tickTime = 0; }
@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(); }