当前位置: 首页>>代码示例>>Java>>正文


Java AspectList.getAmount方法代码示例

本文整理汇总了Java中thaumcraft.api.aspects.AspectList.getAmount方法的典型用法代码示例。如果您正苦于以下问题:Java AspectList.getAmount方法的具体用法?Java AspectList.getAmount怎么用?Java AspectList.getAmount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在thaumcraft.api.aspects.AspectList的用法示例。


在下文中一共展示了AspectList.getAmount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: CrucibleRecipe

import thaumcraft.api.aspects.AspectList; //导入方法依赖的package包/类
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();
}
 
开发者ID:PrincessRTFM,项目名称:TweakCraft,代码行数:23,代码来源:CrucibleRecipe.java

示例2: matches

import thaumcraft.api.aspects.AspectList; //导入方法依赖的package包/类
public boolean matches(AspectList itags, ItemStack cat) {
	if ( (catalyst instanceof ItemStack) && !ThaumcraftApiHelper.itemMatches((ItemStack) catalyst, cat, false)) {
		return false;
	}
	else if ( (catalyst instanceof ArrayList) && ( ((ArrayList<ItemStack>) catalyst).size() > 0)) {
		ItemStack[] ores = ((ArrayList<ItemStack>) catalyst).toArray(new ItemStack[] {});
		if (!ThaumcraftApiHelper.containsMatch(false, new ItemStack[] {
			cat
		}, ores)) {
			return false;
		}
	}
	if (itags == null) {
		return false;
	}
	for (Aspect tag : aspects.getAspects()) {
		if (itags.getAmount(tag) < aspects.getAmount(tag)) {
			return false;
		}
	}
	return true;
}
 
开发者ID:PrincessRTFM,项目名称:TweakCraft,代码行数:23,代码来源:CrucibleRecipe.java

示例3: CrucibleRecipe

import thaumcraft.api.aspects.AspectList; //导入方法依赖的package包/类
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();
}
 
开发者ID:Brandomine,项目名称:Augury,代码行数:24,代码来源:CrucibleRecipe.java

示例4: matches

import thaumcraft.api.aspects.AspectList; //导入方法依赖的package包/类
public boolean matches(AspectList itags, ItemStack cat)
{
    if(catalyst instanceof ItemStack && !ThaumcraftApiHelper.itemMatches((ItemStack) catalyst, cat, false))
    {
        return false;
    }
    else if(catalyst instanceof ArrayList && ((ArrayList<ItemStack>) catalyst).size() > 0)
    {
        ItemStack[] ores = ((ArrayList<ItemStack>) catalyst).toArray(new ItemStack[]{});
        if(!ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{cat}, ores)) return false;
    }
    if(itags == null) return false;
    for(Aspect tag : aspects.getAspects())
    {
        if(itags.getAmount(tag) < aspects.getAmount(tag)) return false;
    }
    return true;
}
 
开发者ID:J3FF97,项目名称:Steel-Industries,代码行数:19,代码来源:CrucibleRecipe.java

示例5: renderItem

import thaumcraft.api.aspects.AspectList; //导入方法依赖的package包/类
@Override
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack stack, Object... data) {
    GL11.glEnable(GL11.GL_ALPHA_TEST);

    AspectList aspects = ((ItemJarFilled)ConfigItems.itemJarFilled).getAspects(stack);
    if(aspects != null) {
        tile.aspect = aspects.getAspects()[0];
        tile.amount = aspects.getAmount(tile.aspect);
    } else {
        tile.aspect = null;
        tile.amount = 0;
    }

    if(stack.hasTagCompound()) {
        tile.networkId = NBTHelper.getUUID(stack.getTagCompound(), "networkId");
    }

    super.renderItem(type, stack, data);

    GL11.glPushMatrix();
    GL11.glTranslatef(0.5f, 0.5f, 0.5f);

    RenderingRegistry.instance().renderInventoryBlock(RenderBlocks.getInstance(), RegisteredBlocks.blockRemoteJar, 0, RegisteredBlocks.blockRemoteJar.getRenderType());
    GL11.glPopMatrix();
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:26,代码来源:ItemRenderRemoteJar.java

示例6: affect

import thaumcraft.api.aspects.AspectList; //导入方法依赖的package包/类
@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;
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:20,代码来源:RegisteredManipulations.java

示例7: placeBlockAt

import thaumcraft.api.aspects.AspectList; //导入方法依赖的package包/类
@Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
    boolean placed = super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata);
    if (placed && stack.hasTagCompound()) {
        TileRemoteJar tile = (TileRemoteJar) world.getTileEntity(x, y, z);

        AspectList aspects = ((ItemJarFilled) ConfigItems.itemJarFilled).getAspects(stack);
        if(aspects != null) {
            tile.aspect = aspects.getAspects()[0];
            tile.amount = aspects.getAmount(tile.aspect);
        }

        if(!world.isRemote) {
            tile.networkId = NBTHelper.getUUID(stack.getTagCompound(), "networkId");
            tile.markForUpdate();
        }
    }
    return placed;
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:20,代码来源:ItemBlockRemoteJar.java

示例8: rechargeNodeInRange

import thaumcraft.api.aspects.AspectList; //导入方法依赖的package包/类
public static boolean rechargeNodeInRange(List<Chunk> chunks, World world, int xCoord, int yCoord, int zCoord, int range) {
	Collections.shuffle(chunks);
	for (Chunk chunk : chunks) {
    	INode nearestNode = findNode(chunk, xCoord, yCoord, zCoord, range);
    	boolean nodeChanged = false;
        if (nearestNode != null) {
            AspectList baseAspects = nearestNode.getAspectsBase().copy();
            AspectList currentAspects = nearestNode.getAspects().copy();
            for (Aspect aspect : nearestNode.getAspects().getAspects()) {
            	int diff = baseAspects.getAmount(aspect) - currentAspects.getAmount(aspect);
            	if (1 < diff) {
            		nearestNode.addToContainer(aspect, world.rand.nextInt(diff - 1) + 1);
            		nodeChanged = true;
            	}
            	else if (diff == 1) {
            		nearestNode.addToContainer(aspect, 1);
            		nodeChanged = true;
            	}
            }
            if (nodeChanged) {
            	updateNode(nearestNode, world);
            }
        	return true;
        }
    }
	return false;
}
 
开发者ID:MagicBees,项目名称:MagicBees,代码行数:28,代码来源:NodeHelper.java

示例9: growNodeInRange

import thaumcraft.api.aspects.AspectList; //导入方法依赖的package包/类
public static boolean growNodeInRange(List<Chunk> chunks, World world, int xCoord, int yCoord, int zCoord, int range) {
	Collections.shuffle(chunks);
	int attemptedNodes = 0;
	for (Chunk chunk : chunks) {
		for (INode node : findNodesInChunkWithinRange(chunk, xCoord, yCoord, zCoord, range)) {
			if (node != null) {
				++attemptedNodes;
				AspectList aspectsBase = node.getAspectsBase();
				int randBase = Math.max(aspectsBase.visSize(), 1);
	            if (world.rand.nextInt(randBase) < 120) {
					Aspect aspectToAdd;
					int rollAttempts = 0;
					do {
						aspectToAdd = getWeightedRandomAspect(world.rand);
						++rollAttempts;
					}
					while (aspectsBase.getAmount(aspectToAdd) < 255 && 20 < rollAttempts);
					
					if (20 <= rollAttempts) {
						return false;
					}
					
					short amount = (short)(1 + world.rand.nextInt(2));
					aspectsBase.add(aspectToAdd, amount);
					node.getAspects().add(aspectToAdd, amount);
					updateNode(node, world);
					return true;
	            }
			}
		}
	}
	return attemptedNodes < 10;
}
 
开发者ID:MagicBees,项目名称:MagicBees,代码行数:34,代码来源:NodeHelper.java

示例10: matches

import thaumcraft.api.aspects.AspectList; //导入方法依赖的package包/类
public boolean matches(AspectList itags, ItemStack cat) {
	if (catalyst instanceof ItemStack &&
			!ThaumcraftApiHelper.itemMatches((ItemStack) catalyst,cat,false)) {
		return false;
	} else 
	if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
		ItemStack[] ores = ((ArrayList<ItemStack>)catalyst).toArray(new ItemStack[]{});
		if (!ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{cat},ores)) return false;
	}
	if (itags==null) return false;
	for (Aspect tag:aspects.getAspects()) {
		if (itags.getAmount(tag)<aspects.getAmount(tag)) return false;
	}
	return true;
}
 
开发者ID:Brandomine,项目名称:Augury,代码行数:16,代码来源:CrucibleRecipe.java

示例11: CrucibleRecipe

import thaumcraft.api.aspects.AspectList; //导入方法依赖的package包/类
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();
}
 
开发者ID:J3FF97,项目名称:Steel-Industries,代码行数:30,代码来源:CrucibleRecipe.java

示例12: GuiResearchRecipeAuraEffects

import thaumcraft.api.aspects.AspectList; //导入方法依赖的package包/类
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) {}
        }
    }
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:40,代码来源:GuiResearchRecipeAuraEffects.java

示例13: add

import thaumcraft.api.aspects.AspectList; //导入方法依赖的package包/类
@Override
public AspectList add(Aspect aspect, int amount) {
    AspectList al = new AspectList();
    al.add(aspect, amount);
    al = ResearchManager.reduceToPrimals(al);
    for(Aspect a : al.getAspects()) {
        super.add(a, al.getAmount(a));
    }
    return this;
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:11,代码来源:PrimalAspectList.java

示例14: drainAspectFromWand

import thaumcraft.api.aspects.AspectList; //导入方法依赖的package包/类
private Aspect drainAspectFromWand(int cap) {
    ItemStack stack = getStackInSlot(0);
    if(stack == null || !(stack.getItem() instanceof ItemWandCasting)) return null; //Should never happen..
    AspectList aspects = ((ItemWandCasting) stack.getItem()).getAllVis(stack);
    for(Aspect a : getRandomlyOrderedPrimalAspectList()) {
        if(aspects.getAmount(a) >= 100 && workAspectList.getAmount(a) < cap) {
            int amt = aspects.getAmount(a);
            ((ItemWandCasting) stack.getItem()).storeVis(stack, a, amt - 100);
            workAspectList.add(a, 1);
            return a;
        }
    }
    return null;
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:15,代码来源:TileNodeManipulator.java

示例15: canDrainFromWand

import thaumcraft.api.aspects.AspectList; //导入方法依赖的package包/类
private boolean canDrainFromWand(int cap) {
    ItemStack stack = getStackInSlot(0);
    if(stack == null || !(stack.getItem() instanceof ItemWandCasting)) return false;
    AspectList aspects = ((ItemWandCasting) stack.getItem()).getAllVis(stack);
    for(Aspect a : Aspect.getPrimalAspects()) {
        if(aspects.getAmount(a) < 100) continue;
        if(workAspectList.getAmount(a) < cap) return true;
    }
    return false;
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:11,代码来源:TileNodeManipulator.java


注:本文中的thaumcraft.api.aspects.AspectList.getAmount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。