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

Java IGenome类代码示例

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

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



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

示例1: addGenome

import forestry.api.genetics.IGenome; //导入依赖的package包/类
@Override
protected void addGenome(ItemStack stack, IGenome origGenome, HashMap<String, Object> ret) {
	IButterflyGenome genome = (IButterflyGenome) origGenome;
	ret.put("speciesPrimary", genome.getPrimary().getName());
	ret.put("speciesSecondary", genome.getSecondary().getName());
	ret.put("speed", genome.getSpeed());
	ret.put("lifespan", genome.getLifespan());
	ret.put("metabolism", genome.getMetabolism());
	ret.put("fertility", genome.getFertility());
	ret.put("nocturnal", genome.getNocturnal());
	ret.put("tolerantFlyer", genome.getTolerantFlyer());
	ret.put("fireResistant", genome.getFireResist());
	ret.put("flower", genome.getFlowerProvider().getDescription());
	ret.put("effect", genome.getEffect().getUID());
	ret.put("temperature", genome.getPrimary().getTemperature().toString());
	ret.put("toleranceTemperature", genome.getToleranceTemp().toString());
	ret.put("humidity", genome.getPrimary().getHumidity().toString());
	ret.put("toleranceHumidity", genome.getToleranceHumid().toString());
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:20,代码来源:TileEntityAnalyzerButterfly.java


示例2: addGenome

import forestry.api.genetics.IGenome; //导入依赖的package包/类
@Override
protected void addGenome(ItemStack stack, IGenome origGenome, HashMap<String,Object> ret) {
	IBeeRoot root = (IBeeRoot) getRoot();
	IBeeGenome genome = (IBeeGenome) origGenome;
	ret.put("type", root.getType(stack).name());
	ret.put("speciesPrimary", genome.getPrimary().getName());
	ret.put("speciesSecondary", genome.getSecondary().getName());
	ret.put("speed", genome.getSpeed());
	ret.put("lifespan", genome.getLifespan());
	ret.put("fertility", genome.getFertility());
	ret.put("nocturnal", genome.getNocturnal());
	ret.put("tolerantFlyer", genome.getTolerantFlyer());
	ret.put("caveDwelling", genome.getCaveDwelling());
	ret.put("flower", genome.getFlowerProvider().getDescription());
	ret.put("territory", Util.arrayToMap(genome.getTerritory()));
	ret.put("effect", genome.getEffect().getUID());
	ret.put("temperature", genome.getPrimary().getTemperature().toString());
	ret.put("toleranceTemperature", genome.getToleranceTemp().toString());
	ret.put("humidity", genome.getPrimary().getHumidity().toString());
	ret.put("toleranceHumidity", genome.getToleranceHumid().toString());
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:22,代码来源:TileEntityAnalyzerBee.java


示例3: addGenome

import forestry.api.genetics.IGenome; //导入依赖的package包/类
@Override
protected void addGenome(ItemStack stack, IGenome origGenome, HashMap<String, Object> ret) {
	ITreeGenome genome = (ITreeGenome) origGenome;
	ret.put("speciesPrimary", genome.getPrimary().getName());
	ret.put("speciesSecondary", genome.getSecondary().getName());
	ret.put("height", genome.getHeight());
	ret.put("fertility", genome.getFertility());
	ret.put("yield", genome.getYield());
	ret.put("sappiness", genome.getSappiness());
	ret.put("matures", genome.getMaturationTime());
	ret.put("fruit", genome.getFruitProvider().getDescription());
	ret.put("growth", genome.getGrowthProvider().getDescription());
	ret.put("girth", genome.getGirth());
	ret.put("plant", Util.EnumSetToMap(genome.getPlantTypes()));
	ret.put("effect", genome.getEffect().getUID());
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:17,代码来源:TileEntityAnalyzerTree.java


示例4: addGenome

import forestry.api.genetics.IGenome; //导入依赖的package包/类
@Override
protected void addGenome(ItemStack stack, IGenome origGenome, Map<String, Object> ret) {
	IButterflyGenome genome = (IButterflyGenome) origGenome;
	
	ret.put("speciesPrimary", genome.getPrimary().getName());
	ret.put("speciesSecondary", genome.getSecondary().getName());
	ret.put("speed", genome.getSpeed());
	ret.put("lifespan", genome.getLifespan());
	ret.put("metabolism", genome.getMetabolism());
	ret.put("fertility", genome.getFertility());
	ret.put("nocturnal", genome.getNocturnal());
	ret.put("tolerantFlyer", genome.getTolerantFlyer());
	ret.put("fireResistant", genome.getFireResist());
	ret.put("flower", genome.getFlowerProvider().getDescription());
	ret.put("effect", genome.getEffect().getUID());
	ret.put("temperature", genome.getPrimary().getTemperature().toString());
	ret.put("toleranceTemperature", genome.getToleranceTemp().toString());
	ret.put("humidity", genome.getPrimary().getHumidity().toString());
	ret.put("toleranceHumidity", genome.getToleranceHumid().toString());
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:21,代码来源:TileButterflyAnalyzer.java


示例5: addGenome

import forestry.api.genetics.IGenome; //导入依赖的package包/类
@Override
protected void addGenome(ItemStack stack, IGenome origGenome, Map<String, Object> ret) {
	ITreeGenome genome = (ITreeGenome) origGenome;
	
	ret.put("speciesPrimary", genome.getPrimary().getName());
	ret.put("speciesSecondary", genome.getSecondary().getName());
	ret.put("height", genome.getHeight());
	ret.put("fertility", genome.getFertility());
	ret.put("yield", genome.getYield());
	ret.put("sappiness", genome.getSappiness());
	ret.put("matures", genome.getMaturationTime());
	ret.put("fruit", genome.getFruitProvider().getDescription());
	ret.put("growth", genome.getGrowthProvider().getDescription());
	ret.put("girth", genome.getGirth());
	ret.put("plant", Util.iterableToMap(genome.getPlantTypes()));
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:17,代码来源:TileTreeAnalyzer.java


示例6: addGenome

import forestry.api.genetics.IGenome; //导入依赖的package包/类
@Override
protected void addGenome(ItemStack stack, IGenome origGenome, Map<String, Object> ret) {
	IBeeRoot root = (IBeeRoot) getRoot();
	IBeeGenome genome = (IBeeGenome) origGenome;
	
	ret.put("type", Util.camelCase(root.getType(stack).name()));
	ret.put("speciesPrimary", genome.getPrimary().getName());
	ret.put("speciesSecondary", genome.getSecondary().getName());
	ret.put("speed", genome.getSpeed());
	ret.put("lifespan", genome.getLifespan());
	ret.put("fertility", genome.getFertility());
	ret.put("nocturnal", genome.getNocturnal());
	ret.put("tolerantFlyer", genome.getTolerantFlyer());
	ret.put("caveDwelling", genome.getCaveDwelling());
	ret.put("flower", genome.getFlowerProvider().getDescription());
	ret.put("territory", Util.arrayToMap(genome.getTerritory()));
	ret.put("effect", genome.getEffect().getUID());
	ret.put("temperature", genome.getPrimary().getTemperature().toString());
	ret.put("toleranceTemperature", genome.getToleranceTemp().toString());
	ret.put("humidity", genome.getPrimary().getHumidity().toString());
	ret.put("toleranceHumidity", genome.getToleranceHumid().toString());
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:23,代码来源:TileBeeAnalyzer.java


示例7: getChance

import forestry.api.genetics.IGenome; //导入依赖的package包/类
@Override
public int getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
	int processedChance = chance;
	
	BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
	if (biome.temperature < minTemperature || biome.temperature > maxTemperature)
		return 0;
	if (biome.rainfall < minRainfall || biome.rainfall > maxRainfall)
		return 0;

	if (this.allele0.getUID().equals(allele0.getUID()) && this.allele1.getUID().equals(allele1.getUID()))
		return processedChance;
	if (this.allele1.getUID().equals(allele0.getUID()) && this.allele0.getUID().equals(allele1.getUID()))
		return processedChance;

	return 0;
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:18,代码来源:Mutation.java


示例8: getChance

import forestry.api.genetics.IGenome; //导入依赖的package包/类
@Override
public int getChance(IBeeHousing housing, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
	int chance = super.getChance(housing, allele0, allele1, genome0, genome1);

	// If we have no chance anyway, we don't need to check.
	if (chance <= 0)
		return 0;

	World world = housing.getWorld();
	if (blockRequired == null)
		return chance;

	int blockid = world.getBlockId(housing.getXCoord(), housing.getYCoord() - 1, housing.getZCoord());
	int meta = world.getBlockMetadata(housing.getXCoord(), housing.getYCoord() - 1, housing.getZCoord());
	if (blockid == blockRequired.itemID && meta == blockRequired.getItemDamage())
		return chance;
	else
		return 0;
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:20,代码来源:MutationReqRes.java


示例9: isGeneticEqual

import forestry.api.genetics.IGenome; //导入依赖的package包/类
@Override
public boolean isGeneticEqual(IGenome other) {
	IChromosome[] genetics = other.getChromosomes();
	if(chromosomes.length != genetics.length)
		return false;
	
	for(int i = 0; i < chromosomes.length; i++) {
		IChromosome chromosome = chromosomes[i];
		if(chromosome == null && genetics[i] != null)
			return false;
		if(chromosome != null && genetics[i] == null)
			return false;
		if(chromosome == null && genetics[i] == null)
			continue;
		
		if(!chromosome.getPrimaryAllele().getUID().equals(genetics[i].getPrimaryAllele().getUID()))
			return false;
		if(!chromosome.getSecondaryAllele().getUID().equals(genetics[i].getSecondaryAllele().getUID()))
			return false;
	}
	
	return true;
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:24,代码来源:Genome.java


示例10: setItem

import forestry.api.genetics.IGenome; //导入依赖的package包/类
@Nonnull
private ItemStack setItem(int slot, @Nonnull ItemStack itemStack) {
  if (slot < 0 || slot >= items.size()) {
    return ItemStack.EMPTY;
  }

  ItemStack prevStack = items.get(slot);
  if (!prevStack.isEmpty()) {
    this.primarySpeciesUids[slot] = null;
    this.secondarySpeciesUids[slot] = null;
  }

  items.set(slot, itemStack);

  ISpeciesRoot speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot(itemStack);
  if (speciesRoot != null) {
    IIndividual member = speciesRoot.getMember(itemStack);
    if (member != null) {
      IGenome genome = member.getGenome();
      primarySpeciesUids[slot] = genome.getPrimary().getUID();
      secondarySpeciesUids[slot] = genome.getSecondary().getUID();
    }
  }

  return prevStack;
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:27,代码来源:SpeciesItemFilter.java


示例11: getChance

import forestry.api.genetics.IGenome; //导入依赖的package包/类
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
	if (MoonPhase.getMoonPhase(world).isBetween(this.moonPhaseStart, this.moonPhaseEnd)) {
		return this.mutationBonus;
	}
	return 1;
}
 
开发者ID:MagicBees,项目名称:MagicBees,代码行数:8,代码来源:MoonPhaseMutationBonus.java


示例12: getChance

import forestry.api.genetics.IGenome; //导入依赖的package包/类
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
	if (MoonPhase.getMoonPhase(world).isBetween(this.moonPhaseStart, this.moonPhaseEnd)) {
		return 1;
	}
	return 0;
}
 
开发者ID:MagicBees,项目名称:MagicBees,代码行数:8,代码来源:MoonPhaseMutationRestriction.java


示例13: listAllSpecies

import forestry.api.genetics.IGenome; //导入依赖的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


示例14: getChance

import forestry.api.genetics.IGenome; //导入依赖的package包/类
@Override
public int getChance(IBeeHousing housing, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
	int chance = super.getChance(housing, allele0, allele1, genome0, genome1);

	if (chance == 0)
		return 0;

	if (start == null && end == null)
		return chance;

	DayMonth now = new DayMonth();

	// If we are equal to start day, return chance.
	if (Calendar.getInstance().get(Calendar.DAY_OF_MONTH) == start.day && Calendar.getInstance().get(Calendar.MONTH) + 1 == start.month)
		return chance;

	// Still here but not time span? No mutation!
	if (end == null)
		return 0;

	// Equal to end date, return chance.
	if (Calendar.getInstance().get(Calendar.DAY_OF_MONTH) == end.day && Calendar.getInstance().get(Calendar.MONTH) + 1 == end.month)
		return chance;

	// Still a chance we are in between
	if (start.before(now) && end.after(now))
		return chance;

	// Now we finally failed.
	return 0;
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:32,代码来源:MutationTimeLimited.java


示例15: mutateSpecies

import forestry.api.genetics.IGenome; //导入依赖的package包/类
private IChromosome[] mutateSpecies(IBeeHousing housing, IGenome genomeOne, IGenome genomeTwo) {

		World world = housing.getWorld();

		IChromosome[] parent1 = genomeOne.getChromosomes();
		IChromosome[] parent2 = genomeTwo.getChromosomes();

		IGenome genome0;
		IGenome genome1;
		IAllele allele0;
		IAllele allele1;

		if (world.rand.nextBoolean()) {
			allele0 = parent1[EnumBeeChromosome.SPECIES.ordinal()].getPrimaryAllele();
			allele1 = parent2[EnumBeeChromosome.SPECIES.ordinal()].getSecondaryAllele();

			genome0 = genomeOne;
			genome1 = genomeTwo;
		} else {
			allele0 = parent2[EnumBeeChromosome.SPECIES.ordinal()].getPrimaryAllele();
			allele1 = parent1[EnumBeeChromosome.SPECIES.ordinal()].getSecondaryAllele();

			genome0 = genomeTwo;
			genome1 = genomeOne;
		}

		for (IBeeMutation mutation : BeeManager.breedingManager.getMutations(true)) {
			int chance = 0;

			if ((chance = mutation.getChance(housing, allele0, allele1, genome0, genome1)) > 0)
				if (world.rand.nextInt(100) < chance) {
					IApiaristTracker breedingTracker = BeeManager.breedingManager.getApiaristTracker(world, housing.getOwnerName());
					breedingTracker.registerMutation(mutation);
					return BeeManager.beeInterface.templateAsChromosomes(mutation.getTemplate());
				}
		}

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


示例16: getChance

import forestry.api.genetics.IGenome; //导入依赖的package包/类
@Override
public int getChance(IBeeHousing housing, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {

	World world = housing.getWorld();
	if (requiresDay && !world.isDaytime())
		return 0;

	if (requiresNight && world.isDaytime())
		return 0;

	// Skip if we are restricted by biomes and this one does not match.
	if (restrictBiomes.size() > 0 && !restrictBiomes.contains(housing.getBiomeId()))
		return 0;

	BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(housing.getXCoord(), housing.getZCoord());
	if (biome.temperature < minTemperature || biome.temperature > maxTemperature)
		return 0;
	if (biome.rainfall < minRainfall || biome.rainfall > maxRainfall)
		return 0;

	int processedChance = Math.round(chance * housing.getMutationModifier((IBeeGenome) genome0, (IBeeGenome) genome1)
			* BeeManager.breedingManager.getBeekeepingMode(world).getMutationModifier((IBeeGenome) genome0, (IBeeGenome) genome1));

	if (this.allele0.getUID().equals(allele0.getUID()) && this.allele1.getUID().equals(allele1.getUID()))
		return processedChance;
	if (this.allele1.getUID().equals(allele0.getUID()) && this.allele0.getUID().equals(allele1.getUID()))
		return processedChance;

	return 0;

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


示例17: getAllele

import forestry.api.genetics.IGenome; //导入依赖的package包/类
@Override
public IAllele getAllele(IGenome genome, IChromosomeType chromosomeType) {
	return genome.getActiveAllele(chromosomeType);
}
 
开发者ID:OpenMods,项目名称:OpenPeripheral-Integration,代码行数:5,代码来源:ConverterIIndividual.java


示例18: getOffspringSpecies

import forestry.api.genetics.IGenome; //导入依赖的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


示例19: mutateSpecies

import forestry.api.genetics.IGenome; //导入依赖的package包/类
private IChromosome[] mutateSpecies(World world, int x, int y, int z, IGenome genomeOne, IGenome genomeTwo) {

		IChromosome[] parent1 = genomeOne.getChromosomes();
		IChromosome[] parent2 = genomeTwo.getChromosomes();

		IGenome genome0;
		IGenome genome1;
		IAllele allele0;
		IAllele allele1;

		if (world.rand.nextBoolean()) {
			allele0 = parent1[EnumTreeChromosome.SPECIES.ordinal()].getPrimaryAllele();
			allele1 = parent2[EnumTreeChromosome.SPECIES.ordinal()].getSecondaryAllele();

			genome0 = genomeOne;
			genome1 = genomeTwo;
		} else {
			allele0 = parent2[EnumTreeChromosome.SPECIES.ordinal()].getPrimaryAllele();
			allele1 = parent1[EnumTreeChromosome.SPECIES.ordinal()].getSecondaryAllele();

			genome0 = genomeTwo;
			genome1 = genomeOne;
		}

		Collections.shuffle(TreeManager.treeMutations);
		for (ITreeMutation mutation : TreeManager.treeMutations) {
			int chance = 0;

			// Stop blacklisted species.
			//if (BeeManager.breedingManager.isBlacklisted(mutation.getTemplate()[0].getUID())) {
			//	continue;
			//}

			if ((chance = mutation.getChance(world, x, y, z, allele0, allele1, genome0, genome1)) > 0)
				if (world.rand.nextInt(100) < chance) {
					//IApiaristTracker breedingTracker = BeeManager.breedingManager.getApiaristTracker(world);
					//breedingTracker.registerMutation(mutation);
					return TreeManager.treeInterface.templateAsChromosomes(mutation.getTemplate());
				}
		}

		return null;
	}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:44,代码来源:Tree.java


示例20: itemMatched

import forestry.api.genetics.IGenome; //导入依赖的package包/类
private boolean itemMatched(@Nonnull ItemStack item) {
  if (Prep.isInvalid(item)) {
    return false;
  }

  ISpeciesRoot speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot(item);
  if (speciesRoot == null) {
    return false;
  }

  IIndividual member = speciesRoot.getMember(item);
  if (member == null) {
    return false;
  }

  IGenome genome = member.getGenome();
  String primarySpeciesUid = genome.getPrimary().getUID();
  String secondarySpeciesUid = genome.getSecondary().getUID();

  for (int slot = 0; slot < items.size(); slot++) {
    ItemStack slotItem = items.get(slot);
    if (slotItem.getItem() == item.getItem()) {
      switch (speciesMode) {
      case BOTH:
        if (primarySpeciesUids[slot].equals(primarySpeciesUid) && secondarySpeciesUids[slot].equals(secondarySpeciesUid)) {
          return true;
        }
        break;
      case PRIMARY:
        if (primarySpeciesUids[slot].equals(primarySpeciesUid)) {
          return true;
        }
        break;
      case SECONDARY:
        if (secondarySpeciesUids[slot].equals(secondarySpeciesUid)) {
          return true;
        }
        break;
      }
    }
  }

  return false;
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:45,代码来源:SpeciesItemFilter.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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