• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java IMutation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getBeeParents

import forestry.api.genetics.IMutation; //导入依赖的package包/类
@ScriptCallable(returnTypes = ReturnType.TABLE, description = "Get possible mutations that results in given bee")
public List<Map<String, Object>> getBeeParents(IBeeHousing housing, @Arg(name = "childType", description = "The type of bee you want the parents for") String childType) {
	ISpeciesRoot beeRoot = AlleleManager.alleleRegistry.getSpeciesRoot("rootBees");
	if (beeRoot == null) return null;

	List<Map<String, Object>> result = Lists.newArrayList();
	childType = childType.toLowerCase(Locale.ENGLISH);

	for (IMutation mutation : beeRoot.getMutations(false)) {
		if (mutation.isSecret() && !Config.showHiddenMutations) continue;
		final IAlleleSpecies species = getOffspringSpecies(mutation);

		if (alleleNameMatches(species, childType)) {
			result.add(serializeMutation(mutation, false));
		}
	}
	return result;
}
 
开发者ID:OpenMods,项目名称:OpenPeripheral-Integration,代码行数:19,代码来源:AdapterBeeHousing.java


示例2: getBeeChildren

import forestry.api.genetics.IMutation; //导入依赖的package包/类
@ScriptCallable(returnTypes = ReturnType.TABLE, description = "Get possible mutations that can be created with given bee")
public List<Map<String, Object>> getBeeChildren(IBeeHousing housing, @Arg(name = "parentYpe", description = "The type of bee you want the children for") String childType) {
	ISpeciesRoot beeRoot = AlleleManager.alleleRegistry.getSpeciesRoot("rootBees");
	if (beeRoot == null) return null;

	List<Map<String, Object>> result = Lists.newArrayList();
	childType = childType.toLowerCase(Locale.ENGLISH);

	for (IMutation mutation : beeRoot.getMutations(false)) {
		if (mutation.isSecret() && !Config.showHiddenMutations) continue;

		if (alleleNameMatches(mutation.getAllele0(), childType) || alleleNameMatches(mutation.getAllele1(), childType)) {
			result.add(serializeMutation(mutation, true));
		}
	}
	return result;
}
 
开发者ID:OpenMods,项目名称:OpenPeripheral-Integration,代码行数:18,代码来源:AdapterBeeHousing.java


示例3: serializeMutation

import forestry.api.genetics.IMutation; //导入依赖的package包/类
private static Map<String, Object> serializeMutation(IMutation mutation, boolean addOffspring) {
	Map<String, Object> parentMap = Maps.newHashMap();

	IAlleleSpecies allele1 = mutation.getAllele0();
	if (allele1 != null) parentMap.put(ALLELE_1, serializeAllele(allele1));

	IAlleleSpecies allele2 = mutation.getAllele1();
	if (allele2 != null) parentMap.put(ALLELE_2, serializeAllele(allele2));

	if (addOffspring) {
		final IAlleleSpecies offspringSpecies = getOffspringSpecies(mutation);
		parentMap.put(MUTATION_RESULT, serializeAllele(offspringSpecies));
	}

	parentMap.put(MUTATION_CHANCE, mutation.getBaseChance());
	parentMap.put(MUTATION_CONDITIONS, mutation.getSpecialConditions());
	return parentMap;
}
 
开发者ID:OpenMods,项目名称:OpenPeripheral-Integration,代码行数:19,代码来源:AdapterBeeHousing.java


示例4: getBeeBreedingData

import forestry.api.genetics.IMutation; //导入依赖的package包/类
@Asynchronous
@ScriptCallable(returnTypes = ReturnType.TABLE, description = "Get the full breeding list thingy. Experimental!")
public List<Map<String, Object>> getBeeBreedingData(IBeeHousing housing) {
	ISpeciesRoot beeRoot = AlleleManager.alleleRegistry.getSpeciesRoot("rootBees");
	if (beeRoot == null) return null;

	List<Map<String, Object>> result = Lists.newArrayList();

	for (IMutation mutation : beeRoot.getMutations(false)) {
		if (mutation.isSecret() && !Config.showHiddenMutations) continue;
		final Map<String, Object> mutationMap = Maps.newHashMap();
		try {
			IAlleleSpecies allele1 = mutation.getAllele0();
			if (allele1 != null) mutationMap.put(ALLELE_1, allele1.getName());
			IAlleleSpecies allele2 = mutation.getAllele1();
			if (allele2 != null) mutationMap.put(ALLELE_2, allele2.getName());

			final IAlleleSpecies offspringSpecies = getOffspringSpecies(mutation);
			mutationMap.put(MUTATION_RESULT, offspringSpecies.getName());

			mutationMap.put(MUTATION_CHANCE, mutation.getBaseChance());
			mutationMap.put(MUTATION_CONDITIONS, mutation.getSpecialConditions());

			result.add(mutationMap);
		} catch (Exception e) {
			throw new RuntimeException(String.format("Failed to get bee breeding information from %s, collected data: %s", mutation, mutationMap), e);
		}
	}
	return result;
}
 
开发者ID:OpenMods,项目名称:OpenPeripheral-Integration,代码行数:31,代码来源:AdapterBeeHousing.java


示例5: listAllSpecies

import forestry.api.genetics.IMutation; //导入依赖的package包/类
@ScriptCallable(returnTypes = ReturnType.TABLE, description = "Get all known bees species")
public List<Map<String, String>> listAllSpecies(IBeeHousing housing) {
	ISpeciesRoot beeRoot = AlleleManager.alleleRegistry.getSpeciesRoot("rootBees");
	if (beeRoot == null) return null;

	final Set<IAlleleSpecies> allSpecies = Sets.newTreeSet(alleleCompatator);

	// approach 1: parents and children of all mutations
	for (IMutation mutation : beeRoot.getMutations(false)) {
		allSpecies.add(mutation.getAllele0());
		allSpecies.add(mutation.getAllele1());
		allSpecies.add(getOffspringSpecies(mutation));
	}

	// approach 2: template bees
	for (IIndividual individual : beeRoot.getIndividualTemplates()) {
		final IGenome genome = individual.getGenome();
		allSpecies.add(genome.getPrimary()); // secondary is same as primary
	}

	// TODO approach 3
	// beeRoot.getRegisteredAlleles(EnumBeeChromosome.SPECIES) (Forestry 4.2 API)

	final List<Map<String, String>> result = Lists.newArrayList();

	for (IAlleleSpecies allele : allSpecies)
		if (!allele.isSecret() || Config.showHiddenBees) result.add(serializeAllele(allele));

	return result;
}
 
开发者ID:OpenMods,项目名称:OpenPeripheral-Integration,代码行数:31,代码来源:AdapterBeeHousing.java


示例6: getCombinations

import forestry.api.genetics.IMutation; //导入依赖的package包/类
public static IMutation[] getCombinations(IAllele allele) {
	ArrayList<IMutation> combinations = new ArrayList<IMutation>();
	for (IMutation mutation : BeeManager.breedingManager.getMutations(false))
		if (mutation.isPartner(allele)) {
			combinations.add(mutation);
		}

	return combinations.toArray(new IMutation[0]);
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:10,代码来源:BeeTemplates.java


示例7: drawMutationInfo

import forestry.api.genetics.IMutation; //导入依赖的package包/类
private void drawMutationInfo(IMutation combination, IAllele species, int x) {

		itemRenderer.renderItemIntoGUI(fontRenderer, mc.renderEngine, iconStacks.get(combination.getPartner(species).getUID()), adjustToFactor(guiLeft) + x, adjustToFactor(guiTop) + getLineY());
		itemRenderer.renderItemOverlayIntoGUI(fontRenderer, mc.renderEngine, iconStacks.get(combination.getPartner(species).getUID()), adjustToFactor(guiLeft) + x, adjustToFactor(guiTop) + getLineY());

		IAllele result = combination.getTemplate()[EnumBeeChromosome.SPECIES.ordinal()];
		itemRenderer.renderItemIntoGUI(fontRenderer, mc.renderEngine, iconStacks.get(result.getUID()), adjustToFactor(guiLeft) + x + 33, adjustToFactor(guiTop) + getLineY());
		itemRenderer.renderItemOverlayIntoGUI(fontRenderer, mc.renderEngine, iconStacks.get(result.getUID()), adjustToFactor(guiLeft) + x + 33, adjustToFactor(guiTop) + getLineY());

		int line = 0;
		int column = 196;

		switch (EnumMutateChance.rateChance(combination.getBaseChance())) {
		case HIGHEST:
			column = 226;
			line = 9;
			break;
		case HIGHER:
			column = 211;
			line = 9;
			break;
		case HIGH:
			line = 9;
			break;
		case NORMAL:
			column = 226;
			break;
		case LOW:
			column = 211;
			break;
		case LOWEST:
		default:
			break;
		}

		mc.renderEngine.bindTexture(mc.renderEngine.getTexture(Defaults.TEXTURE_PATH_GUI + "/beealyzer.png"));
		drawTexturedModalRect(adjustToFactor(guiLeft) + x + 18, adjustToFactor(guiTop) + getLineY() + 4, column, line, 15, 9);

	}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:40,代码来源:GuiBeealyzer.java


示例8: drawUnknownMutation

import forestry.api.genetics.IMutation; //导入依赖的package包/类
private void drawUnknownMutation(IMutation combination, IAllele species, int x) {

		// Question marks
		mc.renderEngine.bindTexture(mc.renderEngine.getTexture(Defaults.TEXTURE_PATH_GUI + "/beealyzer.png"));
		drawTexturedModalRect(adjustToFactor(guiLeft) + x, adjustToFactor(guiTop) + getLineY(), 196, 18, 16, 16);
		
		mc.renderEngine.bindTexture(mc.renderEngine.getTexture(Defaults.TEXTURE_PATH_GUI + "/beealyzer.png"));
		drawTexturedModalRect(adjustToFactor(guiLeft) + x + 32, adjustToFactor(guiTop) + getLineY(), 196, 18, 16, 16);

		int line = 0;
		int column = 196;

		switch (EnumMutateChance.rateChance(combination.getBaseChance())) {
		case HIGHEST:
			column = 226;
			line = 9;
			break;
		case HIGHER:
			column = 211;
			line = 9;
			break;
		case HIGH:
			line = 9;
			break;
		case NORMAL:
			column = 226;
			break;
		case LOW:
			column = 211;
			break;
		case LOWEST:
		default:
			break;
		}

		// Probability arrow
		mc.renderEngine.bindTexture(mc.renderEngine.getTexture(Defaults.TEXTURE_PATH_GUI + "/beealyzer.png"));
		drawTexturedModalRect(adjustToFactor(guiLeft) + x + 18, adjustToFactor(guiTop) + getLineY() + 4, column, line, 15, 9);

	}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:41,代码来源:GuiBeealyzer.java


示例9: displaySpeciesInformation

import forestry.api.genetics.IMutation; //导入依赖的package包/类
private void displaySpeciesInformation(boolean analyzed, IAlleleBeeSpecies species, ItemStack iconStack, int x) {

		if (!analyzed) {
			drawLine(StringUtil.localize("gui.unknown"), x);
			return;
		}

		drawLine(species.getName(), x);
		itemRenderer.renderItemIntoGUI(fontRenderer, mc.renderEngine, iconStack, adjustToFactor(guiLeft + x + 69), adjustToFactor(guiTop + getLineY() - 2));
		itemRenderer.renderItemOverlayIntoGUI(fontRenderer, mc.renderEngine, iconStack, adjustToFactor(guiLeft + x + 69), adjustToFactor(guiTop + getLineY() - 2));

		newLine();
		
		// Viable Combinations
		int columnWidth = 16;
		int column = 10;

		for (IMutation combination : BeeTemplates.getCombinations(species)) {
			if (combination.isSecret()) {
				continue;
			}

			if (breedingTracker.isDiscovered(combination)) {
				drawMutationIcon(combination, species, column);
			} else {
				drawUnknownIcon(combination, column);
			}
			
			column += columnWidth;
			if(column > 75) {
				column = 10;
				newLine(18);
			}
		}
		
		newLine();
		newLine();
	}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:39,代码来源:GuiApiaristInventory.java


示例10: drawMutationIcon

import forestry.api.genetics.IMutation; //导入依赖的package包/类
private void drawMutationIcon(IMutation combination, IAlleleBeeSpecies species, int x) {
	itemRenderer.renderItemIntoGUI(fontRenderer, mc.renderEngine, iconStacks.get(combination.getPartner(species).getUID()), adjustToFactor(guiLeft + x), adjustToFactor(guiTop + getLineY()));
	itemRenderer.renderItemOverlayIntoGUI(fontRenderer, mc.renderEngine, iconStacks.get(combination.getPartner(species).getUID()), adjustToFactor(guiLeft + x), adjustToFactor(guiTop + getLineY()));

	int line = 48;
	int column = 0;
	EnumMutateChance chance = EnumMutateChance.rateChance(combination.getBaseChance());
	if (chance == EnumMutateChance.HIGHEST) {
		line += 16;
		column = 228;
	} else if (chance == EnumMutateChance.HIGHER) {
		line += 16;
		column = 212;
	} else if (chance == EnumMutateChance.HIGH) {
		line += 16;
		column = 196;
	} else if (chance == EnumMutateChance.NORMAL) {
		line += 0;
		column = 228;
	} else if (chance == EnumMutateChance.LOW) {
		line += 0;
		column = 212;
	} else {
		line += 0;
		column = 196;
	}

	mc.renderEngine.bindTexture(mc.renderEngine.getTexture(Defaults.TEXTURE_PATH_GUI + "/apiaristinventory.png"));
	drawTexturedModalRect(adjustToFactor(guiLeft + x), adjustToFactor(guiTop + getLineY()), column, line, 16, 16);

}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:32,代码来源:GuiApiaristInventory.java


示例11: drawUnknownIcon

import forestry.api.genetics.IMutation; //导入依赖的package包/类
private void drawUnknownIcon(IMutation mutation, int x) {

		int chance = mutation.getBaseChance();

		int line = 0;
		int column = 0;
		if (chance >= 20) {
			line = 16;
			column = 228;
		} else if (chance >= 15) {
			line = 16;
			column = 212;
		} else if (chance >= 12) {
			line = 16;
			column = 196;
		} else if (chance >= 10) {
			line = 0;
			column = 228;
		} else if (chance >= 5) {
			line = 0;
			column = 212;
		} else {
			line = 0;
			column = 196;
		}

		mc.renderEngine.bindTexture(mc.renderEngine.getTexture(Defaults.TEXTURE_PATH_GUI + "/apiaristinventory.png"));
		drawTexturedModalRect(adjustToFactor(guiLeft + x), adjustToFactor(guiTop + getLineY()), column, line, 16, 16);
	}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:30,代码来源:GuiApiaristInventory.java


示例12: MutationDiscovered

import forestry.api.genetics.IMutation; //导入依赖的package包/类
public MutationDiscovered(ISpeciesRoot root, GameProfile username, IMutation allele,  IBreedingTracker tracker) {
	super(root, username, tracker);
	this.allele = allele;
}
 
开发者ID:austinv11,项目名称:DartCraft2,代码行数:5,代码来源:ForestryEvent.java


示例13: getOffspringSpecies

import forestry.api.genetics.IMutation; //导入依赖的package包/类
private static IAlleleSpecies getOffspringSpecies(IMutation mutation) {
	final IGenome offspringGenome = mutation.getRoot().templateAsGenome(mutation.getTemplate());
	return (IAlleleSpecies)offspringGenome.getActiveAllele(EnumBeeChromosome.SPECIES);
}
 
开发者ID:OpenMods,项目名称:OpenPeripheral-Integration,代码行数:5,代码来源:AdapterBeeHousing.java


示例14: registerMutation

import forestry.api.genetics.IMutation; //导入依赖的package包/类
@Override
public void registerMutation(IMutation mutation) {
	discoveredMutations.add(mutation.getAllele0().getUID() + "-" + mutation.getAllele1().getUID());
	markDirty();
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:6,代码来源:ApiaristTracker.java


示例15: isDiscovered

import forestry.api.genetics.IMutation; //导入依赖的package包/类
@Override
public boolean isDiscovered(IMutation mutation) {
	return discoveredMutations.contains(mutation.getAllele0().getUID() + "-" + mutation.getAllele1().getUID());
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:5,代码来源:ApiaristTracker.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Wander类代码示例发布时间:2022-05-22
下一篇:
Java RespawnLocation类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap