thaumcraft.api.aspects.AspectList Java Examples
The following examples show how to use
thaumcraft.api.aspects.AspectList.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ItemNodeRenderer.java From Gadomancy with GNU Lesser General Public License v3.0 | 6 votes |
public static void renderNodeItem(IItemRenderer.ItemRenderType type, ItemStack item, AspectList aspects, NodeType nodeType, NodeModifier nodeModifier, Object... data) { if (type == IItemRenderer.ItemRenderType.ENTITY) { GL11.glTranslatef(-0.5F, -0.25F, -0.5F); } else if ((type == IItemRenderer.ItemRenderType.EQUIPPED) && ((data[1] instanceof EntityPlayer))) { GL11.glTranslatef(0.0F, 0.0F, -0.5F); } TileNode tjf = new TileNode(); tjf.setAspects(aspects); tjf.setNodeType(nodeType); tjf.blockType = ConfigBlocks.blockAiry; tjf.blockMetadata = 0; GL11.glPushMatrix(); GL11.glTranslated(0.5D, 0.5D, 0.5D); GL11.glScaled(2.0D, 2.0D, 2.0D); renderItemNode(tjf); GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); renderItemNode(tjf); GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); renderItemNode(tjf); GL11.glPopMatrix(); GL11.glEnable(32826); }
Example #2
Source File: ThaumcraftApiHelper.java From OpenPeripheral-Integration with MIT License | 6 votes |
/** * Subtract vis for use by a crafting mechanic. Costs are calculated slightly * differently and things like the frugal enchant is ignored * Must NOT be multiplied by 100 - send the actual vis cost * @param wand the wand itemstack * @param player the player using the wand * @param cost the cost of the operation. * @param doit actually subtract the vis from the wand if true - if false just simulate the result * @return was the vis successfully subtracted */ public static boolean consumeVisFromWandCrafting(ItemStack wand, EntityPlayer player, AspectList cost, boolean doit) { boolean ot = false; try { if(consumeVisFromWandCrafting == null) { Class fake = Class.forName("thaumcraft.common.items.wands.ItemWandCasting"); consumeVisFromWandCrafting = fake.getMethod("consumeAllVisCrafting", ItemStack.class, EntityPlayer.class, AspectList.class, boolean.class); } ot = (Boolean) consumeVisFromWandCrafting.invoke( consumeVisFromWandCrafting.getDeclaringClass().cast(wand.getItem()), wand, player, cost, doit); } catch(Exception ex) { FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.items.wands.ItemWandCasting method consumeAllVisCrafting"); } return ot; }
Example #3
Source File: FocusUpgradeType.java From ForbiddenMagic with Do What The F*ck You Want To Public License | 6 votes |
public FocusUpgradeType(int id, ResourceLocation icon, String name, String text, AspectList aspects) { this.id = (short) id; this.icon = icon; this.name = name; this.text = text; this.aspects = aspects; if (id<types.length && types[id]!=null) { LogManager.getLogger("THAUMCRAFT").fatal("Focus Upgrade id "+id+" already occupied. Ignoring."); return; } // allocate space if (id>=types.length) { FocusUpgradeType[] temp = new FocusUpgradeType[id+1]; System.arraycopy(types, 0, temp, 0, id); types = temp; } types[id] = this; }
Example #4
Source File: CrucibleRecipe.java From Chisel-2 with GNU General Public License v2.0 | 6 votes |
public CrucibleRecipe(String researchKey, ItemStack result, Object cat, AspectList tags) { recipeOutput = result; this.aspects = tags; this.key = researchKey; this.catalyst = cat; if (cat instanceof String) { this.catalyst = OreDictionary.getOres((String) cat); } String hc = researchKey + result.toString(); for (Aspect tag:tags.getAspects()) { hc += tag.getTag()+tags.getAmount(tag); } if (cat instanceof ItemStack) { hc += ((ItemStack)cat).toString(); } else if (cat instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) { for (ItemStack is :(ArrayList<ItemStack>)catalyst) { hc += is.toString(); } } hash = hc.hashCode(); }
Example #5
Source File: FocusUpgradeType.java From GardenCollection with MIT License | 6 votes |
public FocusUpgradeType(int id, ResourceLocation icon, String name, String text, AspectList aspects) { this.id = (short) id; this.icon = icon; this.name = name; this.text = text; this.aspects = aspects; if (id<types.length && types[id]!=null) { LogManager.getLogger("THAUMCRAFT").fatal("Focus Upgrade id "+id+" already occupied. Ignoring."); return; } // allocate space if (id>=types.length) { FocusUpgradeType[] temp = new FocusUpgradeType[id+1]; System.arraycopy(types, 0, temp, 0, types.length); types = temp; } types[id] = this; }
Example #6
Source File: RegisteredManipulations.java From Gadomancy with GNU Lesser General Public License v3.0 | 6 votes |
@Override public boolean affect(World world, INode node) { AspectList baseList = node.getAspectsBase(); AspectList list = node.getAspects(); for(Aspect a : baseList.getAspects()) { if(!a.isPrimal()) { Aspect[] subComponents = a.getComponents(); int initialValue = baseList.getAmount(a); list.remove(a); baseList.remove(a); baseList.add(subComponents[0], initialValue); list.add(subComponents[0], initialValue); baseList.add(subComponents[1], initialValue); list.add(subComponents[1], initialValue); return true; } } return false; }
Example #7
Source File: RegisteredRecipes.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
private static List[] createAuraCoreRecipes() { List[] recipes = new List[7]; for(int i = 0; i < 7; i++) { AspectList cost = new AspectList(); switch (i) { case 0: cost.add(Aspect.AIR, 84); break; case 1: cost.add(Aspect.FIRE, 84); break; case 2: cost.add(Aspect.WATER, 84); break; case 3: cost.add(Aspect.EARTH, 84); break; case 4: cost.add(Aspect.ORDER, 84); break; case 5: cost.add(Aspect.ENTROPY, 84); break; case 6: cost.add(Aspect.AIR, 14).add(Aspect.FIRE, 14).add(Aspect.WATER, 14) .add(Aspect.EARTH, 14).add(Aspect.ORDER, 14).add(Aspect.ENTROPY, 14); } ItemWandCasting item = (ItemWandCasting) ConfigItems.itemWandCasting; ItemStack wand = new ItemStack(item); item.setRod(wand, ConfigItems.WAND_ROD_GREATWOOD); item.setCap(wand, ConfigItems.WAND_CAP_GOLD); recipes[i] = Arrays.asList(cost, 3, 2, 3, Arrays.asList( null, null, null, null, wand, null, null, null, null, null, null, null, null, new ItemStack(ConfigBlocks.blockCrystal, 1, i), new ItemStack(RegisteredItems.itemAuraCore), null, null, null )); } return recipes; }
Example #8
Source File: ItemCreativeNode.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
@Override public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { ForgeDirection dir = ForgeDirection.getOrientation(side); x += dir.offsetX; y += dir.offsetY; z += dir.offsetZ; if(placeRandomNode(world, x, y, z)) { int metadata = stack.getItemDamage(); TileNode node = (TileNode) world.getTileEntity(x, y, z); if(metadata == 0) { node.setNodeType(NodeType.NORMAL); node.setNodeModifier(NodeModifier.BRIGHT); AspectList aspects = new AspectList(); for(Aspect primal : Aspect.getPrimalAspects()) { aspects.add(primal, 500); } node.setAspects(aspects); node.markDirty(); world.markBlockForUpdate(x, y, z); } else { node.setNodeType(NodeType.values()[metadata]); } return true; } return false; }
Example #9
Source File: ItemFocusBasic.java From AdvancedMod with GNU General Public License v3.0 | 5 votes |
@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); } } }
Example #10
Source File: NBTHelper.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
public static void setAspectList(NBTTagCompound compound, String tag, AspectList list) { NBTTagCompound listTag = new NBTTagCompound(); for (Aspect a : list.aspects.keySet()) { int amt = list.aspects.get(a); listTag.setInteger(a.getTag(), amt); } compound.setTag(tag, listTag); }
Example #11
Source File: AdapterAspectContainer.java From OpenPeripheral-Integration with MIT License | 5 votes |
@ScriptCallable(returnTypes = ReturnType.TABLE, description = "Get the map of aspects stored in the block (summed, if there are multiple entries)") public Map<String, Integer> getAspectsSum(IAspectContainer container) { AspectList aspectList = container.getAspects(); if (aspectList == null) return null; Map<String, Integer> result = Maps.newHashMap(); for (Aspect aspect : aspectList.getAspects()) { if (aspect == null) continue; String name = aspect.getName(); int amount = Objects.firstNonNull(result.get(name), 0); result.put(name, amount + aspectList.getAmount(aspect)); } return result; }
Example #12
Source File: ThaumcraftApi.java From ForbiddenMagic with Do What The F*ck You Want To Public License | 5 votes |
/** * @param research the research key required for this recipe to work. Leave blank if it will work without research * @param result the recipe output * @param aspects the vis cost per aspect. * @param recipe The recipe. Format is exactly the same as vanilla recipes. Input itemstacks are NBT sensitive. */ public static ShapedArcaneRecipe addArcaneCraftingRecipe(String research, ItemStack result, AspectList aspects, Object ... recipe) { ShapedArcaneRecipe r= new ShapedArcaneRecipe(research, result, aspects, recipe); craftingRecipes.add(r); return r; }
Example #13
Source File: ShapelessArcaneRecipe.java From AdvancedMod with GNU General Public License v3.0 | 5 votes |
public ShapelessArcaneRecipe(String research, ItemStack result, AspectList aspects, Object... recipe) { output = result.copy(); this.research = research; this.aspects = aspects; for (Object in : recipe) { if (in instanceof ItemStack) { input.add(((ItemStack)in).copy()); } else if (in instanceof Item) { input.add(new ItemStack((Item)in)); } else if (in instanceof Block) { input.add(new ItemStack((Block)in)); } else if (in instanceof String) { input.add(OreDictionary.getOres((String)in)); } else { String ret = "Invalid shapeless ore recipe: "; for (Object tmp : recipe) { ret += tmp + ", "; } ret += output; throw new RuntimeException(ret); } } }
Example #14
Source File: ThaumcraftApiHelper.java From AdvancedMod with GNU General Public License v3.0 | 5 votes |
public static AspectList getAllAspects(int amount) { if (allAspects.get(amount)==null) { AspectList al = new AspectList(); for (Aspect aspect:Aspect.aspects.values()) { al.add(aspect, amount); } allAspects.put(amount, al); } return allAspects.get(amount); }
Example #15
Source File: ResearchItem.java From GardenCollection with MIT License | 5 votes |
public ResearchItem(String key, String category) { this.key = key; this.category = category; this.tags = new AspectList(); this.icon_resource = null; this.icon_item = null; this.displayColumn = 0; this.displayRow = 0; this.setVirtual(); }
Example #16
Source File: ResearchItem.java From AdvancedMod with GNU General Public License v3.0 | 5 votes |
public ResearchItem(String key, String category) { this.key = key; this.category = category; this.tags = new AspectList(); this.icon_resource = null; this.icon_item = null; this.displayColumn = 0; this.displayRow = 0; this.setVirtual(); }
Example #17
Source File: ResearchItem.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
public ResearchItem(String key, String category, AspectList tags, int col, int row, int complex, ItemStack icon) { this.key = key; this.category = category; this.tags = tags; this.icon_item = icon; this.icon_resource = null; this.displayColumn = col; this.displayRow = row; this.complexity = complex; if (complexity < 1) this.complexity = 1; if (complexity > 3) this.complexity = 3; }
Example #18
Source File: ResearchItem.java From Chisel-2 with GNU General Public License v2.0 | 5 votes |
public ResearchItem(String key, String category, AspectList tags, int col, int row, int complex, ItemStack icon) { this.key = key; this.category = category; this.tags = tags; this.icon_item = icon; this.icon_resource = null; this.displayColumn = col; this.displayRow = row; this.complexity = complex; if (complexity < 1) this.complexity = 1; if (complexity > 3) this.complexity = 3; }
Example #19
Source File: ThaumcraftApi.java From AdvancedMod with GNU General Public License v3.0 | 5 votes |
/** * @param research the research key required for this recipe to work. Leave blank if it will work without research * @param result the recipe output * @param aspects the vis cost per aspect. * @param recipe The recipe. Format is exactly the same as vanilla recipes. Input itemstacks are NBT sensitive. */ public static ShapedArcaneRecipe addArcaneCraftingRecipe(String research, ItemStack result, AspectList aspects, Object ... recipe) { ShapedArcaneRecipe r= new ShapedArcaneRecipe(research, result, aspects, recipe); craftingRecipes.add(r); return r; }
Example #20
Source File: ThaumcraftApi.java From AdvancedMod with GNU General Public License v3.0 | 5 votes |
/** * @param research the research key required for this recipe to work. Leave blank if it will work without research * @param result the recipe output * @param aspects the vis cost per aspect * @param recipe The recipe. Format is exactly the same as vanilla shapeless recipes. Input itemstacks are NBT sensitive. */ public static ShapelessArcaneRecipe addShapelessArcaneCraftingRecipe(String research, ItemStack result, AspectList aspects, Object ... recipe) { ShapelessArcaneRecipe r = new ShapelessArcaneRecipe(research, result, aspects, recipe); craftingRecipes.add(r); return r; }
Example #21
Source File: ThaumcraftApi.java From ForbiddenMagic with Do What The F*ck You Want To Public License | 5 votes |
/** * @param research the research key required for this recipe to work. Leave blank if it will work without research * @param result the recipe output * @param aspects the vis cost per aspect * @param recipe The recipe. Format is exactly the same as vanilla shapeless recipes. Input itemstacks are NBT sensitive. */ public static ShapelessArcaneRecipe addShapelessArcaneCraftingRecipe(String research, ItemStack result, AspectList aspects, Object ... recipe) { ShapelessArcaneRecipe r = new ShapelessArcaneRecipe(research, result, aspects, recipe); craftingRecipes.add(r); return r; }
Example #22
Source File: ConverterAspectList.java From OpenPeripheral-Integration with MIT License | 5 votes |
public static List<Map<String, Object>> aspectsToMap(AspectList aspectList) { List<Map<String, Object>> aspects = Lists.newArrayList(); if (aspectList == null) return aspects; for (Aspect aspect : aspectList.getAspects()) { if (aspect == null) continue; appendAspectEntry(aspects, aspect, aspectList.getAmount(aspect)); } return aspects; }
Example #23
Source File: TileExtendedNodeJar.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
public void readCustomNBT(NBTTagCompound nbttagcompound) { this.aspects.readFromNBT(nbttagcompound); this.id = nbttagcompound.getString("nodeId"); AspectList al = new AspectList(); NBTTagList tlist = nbttagcompound.getTagList("AspectsBase", 10); for (int j = 0; j < tlist.tagCount(); j++) { NBTTagCompound rs = tlist.getCompoundTagAt(j); if (rs.hasKey("key")) { al.add(Aspect.getAspect(rs.getString("key")), rs.getInteger("amount")); } } Short oldBase = nbttagcompound.getShort("nodeVisBase"); this.aspectsBase = new AspectList(); if ((oldBase > 0) && (al.size() == 0)) { for (Aspect a : this.aspects.getAspects()) { this.aspectsBase.merge(a, oldBase); } } else { this.aspectsBase = al.copy(); } setNodeType(NodeType.values()[nbttagcompound.getByte("type")]); byte mod = nbttagcompound.getByte("modifier"); if(mod >= 0) setNodeModifier(NodeModifier.values()[mod]); else setNodeModifier(null); byte exType = nbttagcompound.getByte("extendedNodeType"); if(exType >= 0) setExtendedNodeType(ExtendedNodeType.values()[exType]); else setExtendedNodeType(null); if(nbttagcompound.hasKey("Behavior")) { behaviorSnapshot = nbttagcompound.getCompoundTag("Behavior"); } }
Example #24
Source File: BloodMagic.java From ForbiddenMagic with Do What The F*ck You Want To Public License | 5 votes |
private static void aspectBloodItem(String target, int damage, AspectList list) { try { Item item = Compat.getItem("AWWayofTime", target); ThaumcraftApi.registerObjectTag(new ItemStack(item, 1, damage), list); } catch (Exception e) { FMLLog.log(Level.INFO, e, "Forbidden Magic was unable to add aspects to " + target); } }
Example #25
Source File: TileEntityWrathCage.java From ForbiddenMagic with Do What The F*ck You Want To Public License | 5 votes |
public AspectList getAspects() { AspectList list = new AspectList(); if(Config.wrathCost > 0 && spawnLogic.isMobSet()) { if(mode == 0) list.add(aspect, special); else if(mode == 1) list.add(DarkAspects.WRATH, wrath); else list.add(DarkAspects.SLOTH, sloth); } return list; }
Example #26
Source File: ResearchItem.java From GardenCollection with MIT License | 5 votes |
public ResearchItem(String key, String category, AspectList tags, int col, int row, int complex, ResourceLocation icon) { this.key = key; this.category = category; this.tags = tags; this.icon_resource = icon; this.icon_item = null; this.displayColumn = col; this.displayRow = row; this.complexity = complex; if (complexity < 1) this.complexity = 1; if (complexity > 3) this.complexity = 3; }
Example #27
Source File: NodeManipulatorResultHandler.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
public static void combine(AspectList containingList, Aspect a, Aspect b, int addition) { if(!canCombine(a, b)) return; Aspect combination = NodeManipulatorResultHandler.getCombination(a, b); int lowerAmount; if(containingList.getAmount(a) < containingList.getAmount(b)) { lowerAmount = containingList.getAmount(a); } else { lowerAmount = containingList.getAmount(b); } containingList.remove(a, lowerAmount); containingList.remove(b, lowerAmount); containingList.add(combination, lowerAmount + addition); }
Example #28
Source File: ThaumcraftApiHelper.java From ForbiddenMagic with Do What The F*ck You Want To Public License | 5 votes |
public static AspectList getAllCompoundAspects(int amount) { if (allCompoundAspects.get(amount)==null) { AspectList al = new AspectList(); for (Aspect aspect:Aspect.getCompoundAspects()) { al.add(aspect, amount); } allCompoundAspects.put(amount, al); } return allCompoundAspects.get(amount); }
Example #29
Source File: CrucibleRecipe.java From Chisel-2 with GNU General Public License v2.0 | 5 votes |
public AspectList removeMatching(AspectList itags) { AspectList temptags = new AspectList(); temptags.aspects.putAll(itags.aspects); for (Aspect tag:aspects.getAspects()) { temptags.remove(tag, aspects.getAmount(tag)); } itags = temptags; return itags; }
Example #30
Source File: Thaumcraft.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override public void postInit(){ ThaumcraftApi.registerObjectTag(Names.INGOT_IRON_COMPRESSED, new AspectList().add(Aspect.METAL, 8).add(Aspect.AIR, 1)); registerPlasticAspects(ItemPlasticPlants.SQUID_PLANT_DAMAGE, Aspect.DARKNESS); registerPlasticAspects(ItemPlasticPlants.FIRE_FLOWER_DAMAGE, Aspect.FIRE); registerPlasticAspects(ItemPlasticPlants.CREEPER_PLANT_DAMAGE, Aspect.ENERGY); registerPlasticAspects(ItemPlasticPlants.SLIME_PLANT_DAMAGE, Aspect.SLIME); registerPlasticAspects(ItemPlasticPlants.RAIN_PLANT_DAMAGE, Aspect.WATER); registerPlasticAspects(ItemPlasticPlants.ENDER_PLANT_DAMAGE, Aspect.ELDRITCH); registerPlasticAspects(ItemPlasticPlants.LIGHTNING_PLANT_DAMAGE, Aspect.WEATHER); //registerPlasticAspects(ItemPlasticPlants.ADRENALINE_PLANT_DAMAGE , Aspect. registerPlasticAspects(ItemPlasticPlants.POTION_PLANT_DAMAGE, Aspect.POISON); registerPlasticAspects(ItemPlasticPlants.REPULSION_PLANT_DAMAGE, Aspect.ENTROPY); registerPlasticAspects(ItemPlasticPlants.HELIUM_PLANT_DAMAGE, Aspect.LIGHT); registerPlasticAspects(ItemPlasticPlants.CHOPPER_PLANT_DAMAGE, Aspect.AIR); //registerPlasticAspects(ItemPlasticPlants.MUSIC_PLANT_DAMAGE , Aspect. registerPlasticAspects(ItemPlasticPlants.PROPULSION_PLANT_DAMAGE, Aspect.MOTION); registerPlasticAspects(ItemPlasticPlants.FLYING_FLOWER_DAMAGE, Aspect.FLIGHT); ThaumcraftApi.registerObjectTag(new ItemStack(Itemss.turbineBlade), new AspectList().add(Aspect.GREED, 2).add(Aspect.METAL, 3).add(Aspect.MOTION, 2).add(Aspect.ENERGY, 4)); AspectList transAndCapAspects = new AspectList().add(Aspect.ENERGY, 2).add(Aspect.PLANT, 2).add(Aspect.METAL, 6); ThaumcraftApi.registerObjectTag(new ItemStack(Itemss.transistor), transAndCapAspects); ThaumcraftApi.registerObjectTag(new ItemStack(Itemss.capacitor), transAndCapAspects); AspectList pcbAspects = new AspectList().add(Aspect.ENERGY, 1).add(Aspect.PLANT, 2).add(Aspect.METAL, 6); ThaumcraftApi.registerObjectTag(new ItemStack(Itemss.emptyPCB), pcbAspects); ThaumcraftApi.registerObjectTag(new ItemStack(Itemss.unassembledPCB), pcbAspects); ThaumcraftApi.registerObjectTag(new ItemStack(Itemss.airCanister), new AspectList().add(Aspect.METAL, 30).add(Aspect.ENERGY, 4)); /* for(Item item : pcItems) { ThaumcraftApi.registerComplexObjectTag(new ItemStack(item, 1, OreDictionary.WILDCARD_VALUE), new AspectList()); } for(Block block : pcBlocks) { ThaumcraftApi.registerComplexObjectTag(new ItemStack(block, 1, OreDictionary.WILDCARD_VALUE), new AspectList()); }*/ }