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


Java IIndividual.isAnalyzed方法代码示例

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


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

示例1: callMethod

import forestry.api.genetics.IIndividual; //导入方法依赖的package包/类
@Override
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException {
	if (!Config.enableAnalyzers)
		throw new LuaException("Analyzers have been disabled");
	switch (method) {
		case 0:
			ISpeciesRoot root = getRoot();
			ItemStack stack = getStackInSlot(0);
			if (stack == null || !root.isMember(stack))
				return new Object[] {false};
			IIndividual individual = root.getMember(stack);
			if (!individual.isAnalyzed())
				return new Object[] {null};
			HashMap<String, Object> ret = new HashMap<String, Object>();
			addGenome(stack, individual.getGenome(), ret);
			return new Object[] {ret};
		case 1:
			ItemStack specimen = getStackInSlot(0);
			if (specimen == null || !getRoot().isMember(specimen))
				return new Object[] {false};
			return new Object[] {true};
	}
	return new Object[]{};
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:25,代码来源:TileEntityAnalyzer.java

示例2: describeIndividual

import forestry.api.genetics.IIndividual; //导入方法依赖的package包/类
public static Map<String, Object> describeIndividual(IIndividual individual) {
	Map<String, Object> map = Maps.newHashMap();
	map.put("displayName", individual.getDisplayName());
	map.put("ident", individual.getIdent());

	final boolean isAnalyzed = individual.isAnalyzed();
	map.put("isAnalyzed", isAnalyzed);
	map.put("isSecret", individual.isSecret());
	map.put("hasEffect", individual.hasEffect());
	GenomeReader<?, ?> genomeReader = null;

	if (individual instanceof IIndividualLiving) {
		IIndividualLiving living = (IIndividualLiving)individual;
		map.put("health", living.getHealth());
		map.put("maxHealth", living.getMaxHealth());
		map.put("isAlive", living.isAlive());
	}

	if (individual instanceof IBee) {
		IBee bee = (IBee)individual;
		map.put("type", "bee");
		map.put("canSpawn", bee.canSpawn());
		map.put("generation", bee.getGeneration());
		map.put("isNatural", bee.isNatural());

		if (isAnalyzed) genomeReader = new BeeGenomeReader(bee.getGenome());
	} else if (individual instanceof IButterfly) {
		IButterfly butterfly = (IButterfly)individual;
		map.put("type", "butterfly");
		map.put("size", butterfly.getSize());
		if (isAnalyzed) genomeReader = new ButterflyGenomeReader(butterfly.getGenome());
	} else if (individual instanceof ITree) {
		ITree tree = (ITree)individual;
		map.put("type", "tree");
		map.put("plantType", tree.getPlantTypes().toString());
		if (isAnalyzed) genomeReader = new TreeGenomeReader(tree.getGenome());
	}

	if (genomeReader != null) {
		map.put("active", genomeReader.getActiveInfo());
		map.put("inactive", genomeReader.getInactiveInfo());
	}
	return map;
}
 
开发者ID:OpenMods,项目名称:OpenPeripheral-Integration,代码行数:45,代码来源:ConverterIIndividual.java


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