Java Code Examples for thaumcraft.api.aspects.AspectList#size()

The following examples show how to use thaumcraft.api.aspects.AspectList#size() . 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: ItemExtendedNodeJar.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
    String desc = "ยง9" + StatCollector.translateToLocal("nodetype." + getNodeType(stack) + ".name");
    if(getExtendedNodeType(stack) != null) {
        desc = desc + ", " + StatCollector.translateToLocal("gadomancy.nodes." + getExtendedNodeType(stack));
    }
    if (getNodeModifier(stack) != null) {
        desc = desc + ", " + StatCollector.translateToLocal("nodemod." + getNodeModifier(stack) + ".name");
    }
    list.add(desc);
    AspectList aspects = getAspects(stack);
    if ((aspects != null) && (aspects.size() > 0)) {
        for (Aspect tag : aspects.getAspectsSorted()) {
            if (Thaumcraft.proxy.playerKnowledge.hasDiscoveredAspect(player.getCommandSenderName(), tag)) {
                list.add(tag.getName() + " x " + aspects.getAmount(tag));
            } else {
                list.add(StatCollector.translateToLocal("tc.aspect.unknown"));
            }
        }
    }
    super.addInformation(stack, player, list, par4);
}
 
Example 2
Source File: BlockTrackEntryThaumcraft.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void addInformation(World world, int x, int y, int z, TileEntity te, List<String> infoList){
    if(te instanceof IAspectContainer) {
        IAspectContainer container = (IAspectContainer)te;
        AspectList aspects = container.getAspects();
        if(aspects != null && aspects.size() > 0) {
            infoList.add("blockTracker.info.thaumcraft");
            for(Map.Entry<Aspect, Integer> entry : aspects.aspects.entrySet()) {
                infoList.add("-" + entry.getValue() + "x " + entry.getKey().getName());
            }
        } else {
            infoList.add(I18n.format("blockTracker.info.thaumcraft") + " -");
        }
        if(container instanceof INode) {
            INode node = (INode)container;
            infoList.add(I18n.format("blockTracker.info.thaumcraft.nodetype") + " " + I18n.format("nodetype." + node.getNodeType() + ".name"));
            if(node.getNodeModifier() != null) infoList.add(I18n.format("blockTracker.info.thaumcraft.nodeModifier") + " " + I18n.format("nodemod." + node.getNodeModifier() + ".name"));
        }
    }
}
 
Example 3
Source File: GuiResearchRecipeAuraEffects.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public GuiResearchRecipeAuraEffects(ResearchItem research, int page, double x, double y) {
    super(research, page, x, y);

    Injector inj = new Injector(this, GuiResearchRecipe.class);

    ResearchPage[] additionalPages = ResearchPageAuraAspects.createAllAuraPagesFor(Minecraft.getMinecraft().thePlayer);
    ResearchPage[] pages = inj.getField("pages");
    ResearchPage[] newPages = new ResearchPage[pages.length + additionalPages.length];
    System.arraycopy(pages, 0, newPages, 0, pages.length);
    System.arraycopy(additionalPages, 0, newPages, pages.length, additionalPages.length);
    inj.setField("pages", newPages);
    inj.setField("maxPages", newPages.length);

    List<String> list = Thaumcraft.proxy.getScannedObjects().get(Minecraft.getMinecraft().thePlayer.getCommandSenderName());
    if ((list != null) && (list.size() > 0)) {
        for (String s : list) {
            try {
                String s2 = s.substring(1);
                ItemStack is = getFromCache(Integer.parseInt(s2));
                if (is != null) {
                    AspectList tags = ThaumcraftCraftingManager.getObjectTags(is);
                    tags = ThaumcraftCraftingManager.getBonusTags(is, tags);
                    if ((tags != null) && (tags.size() > 0)) {
                        for (Aspect a : tags.getAspects()) {
                            ArrayList<ItemStack> items = itemMap.get(a.getTag());
                            if (items == null) {
                                items = new ArrayList<ItemStack>();
                            }
                            ItemStack is2 = is.copy();
                            is2.stackSize = tags.getAmount(a);
                            items.add(is2);
                            itemMap.put(a.getTag(), items);
                        }
                    }
                }
            } catch (NumberFormatException e) {}
        }
    }
}
 
Example 4
Source File: TileExtendedNodeJar.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
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 5
Source File: ItemExtendedNodeJar.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public AspectList getAspects(ItemStack itemstack) {
    if (itemstack.hasTagCompound()) {
        AspectList aspects = new AspectList();
        aspects.readFromNBT(itemstack.getTagCompound());
        return aspects.size() > 0 ? aspects : null;
    }
    return null;
}
 
Example 6
Source File: ItemFocusBasic.java    From AdvancedMod with GNU General Public License v3.0 5 votes vote down vote up
@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 7
Source File: ItemFocusBasic.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
@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(StatCollector.translateToLocal(isVisCostPerTick(stack)?"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);				
		}
	}
	addFocusInformation(stack,player,list,par4);
}
 
Example 8
Source File: ItemFocusBasic.java    From GardenCollection with MIT License 5 votes vote down vote up
@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(StatCollector.translateToLocal(isVisCostPerTick(stack)?"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);				
		}
	}
	addFocusInformation(stack,player,list,par4);
}
 
Example 9
Source File: ItemBaseFocus.java    From Electro-Magic-Tools with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
	AspectList cost = getVisCost();
	if (cost != null && cost.size() > 0) {
		list.add(StatCollector.translateToLocal(isVisCostPerTick() ? "item.Focus.cost2" : "item.Focus.cost1"));
		for (Aspect aspect : cost.getAspectsSorted()) {
			float amount = cost.getAmount(aspect) / 100.0F;
			list.add(" " + '\u00a7' + aspect.getChatcolor() + aspect.getName() + '\u00a7' + "r x " + amount);
		}
	}
}
 
Example 10
Source File: ItemFocusBasic.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
@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(StatCollector.translateToLocal(isVisCostPerTick(stack)?"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);				
		}
	}
	addFocusInformation(stack,player,list,par4);
}
 
Example 11
Source File: ItemFocusBasic.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@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(StatCollector.translateToLocal(isVisCostPerTick(stack)?"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);				
		}
	}
	addFocusInformation(stack,player,list,par4);
}