當前位置: 首頁>>代碼示例>>Java>>正文


Java BiomeDictionary.hasType方法代碼示例

本文整理匯總了Java中net.minecraftforge.common.BiomeDictionary.hasType方法的典型用法代碼示例。如果您正苦於以下問題:Java BiomeDictionary.hasType方法的具體用法?Java BiomeDictionary.hasType怎麽用?Java BiomeDictionary.hasType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraftforge.common.BiomeDictionary的用法示例。


在下文中一共展示了BiomeDictionary.hasType方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: generate

import net.minecraftforge.common.BiomeDictionary; //導入方法依賴的package包/類
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
		IChunkProvider chunkProvider) {
	if (random.nextInt(20) == 0){
		int x = chunkX * 16 + 2 + random.nextInt(12);
		int z = chunkZ * 16 + 2 + random.nextInt(12);
		BlockPos p = new BlockPos(x,0,z);
		p = world.getHeight(p);
		Biome b = world.getBiome(p);
		if (BiomeDictionary.hasType(b, BiomeDictionary.Type.FOREST) || b == Biomes.FOREST || b == Biomes.FOREST_HILLS){
			if (world.getBlockState(p.down()).getBlock() instanceof BlockGrass && world.isAirBlock(p)){
				BlockTeaSapling.generateTree(world, p, Blocks.AIR.getDefaultState(), random);
			}
		}
	}
}
 
開發者ID:elucent,項目名稱:SimplyTea,代碼行數:17,代碼來源:SimplyTea.java

示例2: getFromBiome

import net.minecraftforge.common.BiomeDictionary; //導入方法依賴的package包/類
public static Anima getFromBiome(Biome biome)
{
	if (BiomeDictionary.hasType(biome, Type.WATER))
		return Anima.DEPTH;
	else if (BiomeDictionary.hasType(biome, Type.FOREST) || BiomeDictionary.hasType(biome, Type.PLAINS))
		return Anima.HORIZON;
	else if (BiomeDictionary.hasType(biome, Type.DRY) || BiomeDictionary.hasType(biome, Type.NETHER)
			|| BiomeDictionary.hasType(biome, Type.HOT))
		return Anima.INFERNO;
	else if (BiomeDictionary.hasType(biome, Type.HILLS) || BiomeDictionary.hasType(biome, Type.MOUNTAIN)
			|| BiomeDictionary.hasType(biome, Type.COLD))
		return Anima.OZONE;
	else if (BiomeDictionary.hasType(biome, Type.MESA))
		return Anima.CHAOS;
	else if (biome.equals(Biomes.MUSHROOM_ISLAND) || biome.equals(Biomes.MUSHROOM_ISLAND_SHORE))
		return Anima.PEACE;
	else
		return Anima.HORIZON;
}
 
開發者ID:raphydaphy,項目名稱:ArcaneMagic,代碼行數:20,代碼來源:Anima.java

示例3: generate

import net.minecraftforge.common.BiomeDictionary; //導入方法依賴的package包/類
@Override
public void generate (Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    int x = chunkX * 16 + 8;
    int z = chunkZ * 16 + 8;

    Biome biome = world.getBiome(new BlockPos(x, 0, z));
    if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.COLD ))
    if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.COLD)
        || BiomeDictionary.hasType(biome, BiomeDictionary.Type.NETHER)
        || BiomeDictionary.hasType(biome, BiomeDictionary.Type.WET)
        || BiomeDictionary.hasType(biome, BiomeDictionary.Type.WASTELAND)
        || BiomeDictionary.hasType(biome, BiomeDictionary.Type.SNOWY))
        return;

    if (!BiomeDictionary.hasType(biome, BiomeDictionary.Type.SANDY))
        return;

    if (random.nextInt(15) > 0)
        return;

    generate(world, random, new BlockPos(x, world.getSeaLevel(), z));
}
 
開發者ID:jaquadro,項目名稱:GardenStuff,代碼行數:23,代碼來源:WorldGenCandelilla.java

示例4: oilPassGenerate

import net.minecraftforge.common.BiomeDictionary; //導入方法依賴的package包/類
public void oilPassGenerate(World worldIn, Random rand, Biome biome, BlockPos pos)
{
	float chance = BiomeDictionary.hasType(biome, BiomeDictionary.Type.SANDY) ? 0.03125F : 0.015625F;
	if (rand.nextFloat() < chance)
	{
		int x = rand.nextInt(16) + 8;
		int z = rand.nextInt(16) + 8;
		BlockPos at = new BlockPos(x, 0, z);
		EventGenOil event = new EventGenOil(worldIn, at, rand, genOil);
		if (MinecraftForge.TERRAIN_GEN_BUS.post(event))
		{
			return;
		}

		event.generator.generate(worldIn, rand, pos.add(at));
	}
}
 
開發者ID:V0idWa1k3r,項目名稱:ExPetrum,代碼行數:18,代碼來源:ExPBiomeDecorator.java

示例5: generateCrystalTree

import net.minecraftforge.common.BiomeDictionary; //導入方法依賴的package包/類
public static boolean generateCrystalTree(final World world, final Random random, final int chunkX, final int chunkZ) {
    final int x = chunkX * 16 + random.nextInt(16);
    final int z = chunkZ * 16 + random.nextInt(16);
    final BlockPos bp = world.getHeight(new BlockPos(x, 0, z));
    Biome biome = world.getBiome(bp);
    if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.FOREST) || biome instanceof BiomeForest) {
    	if(net.minecraftforge.event.terraingen.TerrainGen.decorate(world, random, bp, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.TREE))
        {
    		WoodType type = WoodType.BLUE;
    		try{
    			type = WoodType.byMetadata(MathHelper.getInt(random, 0, WoodType.values().length-1));
    		} catch(Exception e){}
    		int size = MathHelper.getInt(random, 4, 6);
    		final boolean t = new WorldGenCrystalTree(false, size, type, random.nextInt(2) == 0).generate(world, random, bp);
    		return t;
        }
    }
    return false;
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:20,代碼來源:CrystalTreeFeature.java

示例6: onInitialSpawn

import net.minecraftforge.common.BiomeDictionary; //導入方法依賴的package包/類
@Override
@Nullable
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata) {
    livingdata = super.onInitialSpawn(difficulty, livingdata);

    Biome biome = this.getEntityWorld().getBiome(new BlockPos(this));
    if ((BiomeDictionary.hasType(biome, BiomeDictionary.Type.DRY) ||
            BiomeDictionary.hasType(biome, BiomeDictionary.Type.SAVANNA)) &&
            this.getRNG().nextInt(5) > 0) {
        this.setMobType(EnumUndeadMobType.HUSK);
    }

    this.setSkin(new Random().nextInt(CAT_TYPES));

    return livingdata;
}
 
開發者ID:NightKosh,項目名稱:Gravestone-mod-Extended,代碼行數:17,代碼來源:EntityZombieCat.java

示例7: isExcluded

import net.minecraftforge.common.BiomeDictionary; //導入方法依賴的package包/類
protected boolean isExcluded(Biome candidate) {
  for (BiomeDictionary.Type exType : typeExcludes) {
    if (BiomeDictionary.hasType(candidate, exType)) {
      if (Config.spawnConfigPrintDetailedOutput) {
        System.out.print("Excluded " + candidate.getBiomeName() + ", ");
      }
      return true;

    }
  }
  for (ResourceLocation exName : nameExcludes) {
    if (exName != null && exName.equals(candidate.getRegistryName())) {
      System.out.print("Excluded " + candidate.getRegistryName() + ", ");
      return false;
    }
  }
  return false;
}
 
開發者ID:SleepyTrousers,項目名稱:EnderZoo,代碼行數:19,代碼來源:AbstractBiomeFilter.java

示例8: isMatchingBiome

import net.minecraftforge.common.BiomeDictionary; //導入方法依賴的package包/類
@Override
public boolean isMatchingBiome(Biome biome) {

  if (isExcluded(biome)) {
    return false;
  }
  if (!names.isEmpty() && !names.contains(biome.getRegistryName())) {
    return false;
  }
  for (BiomeDictionary.Type type : types) {
    if (!BiomeDictionary.hasType(biome, type)) {
      return false;
    }
  }
  return true;
}
 
開發者ID:SleepyTrousers,項目名稱:EnderZoo,代碼行數:17,代碼來源:BiomeFilterAll.java

示例9: setupSpawns

import net.minecraftforge.common.BiomeDictionary; //導入方法依賴的package包/類
public static void setupSpawns()
{
    for (Biome b : ForgeRegistries.BIOMES)
    {
        if (BiomeDictionary.hasType(b, BiomeDictionary.Type.FOREST))
        {
            net.minecraftforge.fml.common.registry.EntityRegistry.addSpawn(EntityBeetle.class, 3, 4, 5, EnumCreatureType.CREATURE, b);
        }
    }
}
 
開發者ID:PearXTeam,項目名稱:PurificatiMagicae,代碼行數:11,代碼來源:EntityRegistry.java

示例10: getWolfWeight

import net.minecraftforge.common.BiomeDictionary; //導入方法依賴的package包/類
public static int getWolfWeight(World world, Vec3d pos, EntityAnimal mother, EntityAnimal father)
{
    BlockPos blockpos = new BlockPos(pos);
    Biome biome = world.getBiome(blockpos);

    return BiomeDictionary.hasType(biome, BiomeDictionary.Type.CONIFEROUS) ? 50 : 0; //TODO: habitat check
}
 
開發者ID:DaedalusGame,項目名稱:BetterWithAddons,代碼行數:8,代碼來源:AnimalCrossbreedHandler.java

示例11: getOcelotWeight

import net.minecraftforge.common.BiomeDictionary; //導入方法依賴的package包/類
public static int getOcelotWeight(World world, Vec3d pos, EntityAnimal mother, EntityAnimal father)
{
    BlockPos blockpos = new BlockPos(pos);
    Biome biome = world.getBiome(blockpos);

    return BiomeDictionary.hasType(biome, BiomeDictionary.Type.JUNGLE) ? 50 : 0; //TODO: habitat check
}
 
開發者ID:DaedalusGame,項目名稱:BetterWithAddons,代碼行數:8,代碼來源:AnimalCrossbreedHandler.java

示例12: generateFeature

import net.minecraftforge.common.BiomeDictionary; //導入方法依賴的package包/類
@Override
public boolean generateFeature(World world, Random random, int chunkX, int chunkZ, boolean newGen) {
	if(!Config.generateSeaweed)return false;
	
	BlockPos chunkPos = new BlockPos(chunkX * 16, 0, chunkZ * 16);
	for (int i3 = 0; i3 < 5; ++i3)
       {
           int j7 = random.nextInt(16) + 8;
           int i11 = random.nextInt(16) + 8;
           BlockPos center = chunkPos.add(j7, 0, i11);
           int k14 = world.getHeight(center).getY() * 2;

           Biome biome = world.getBiome(chunkPos);
		if(BiomeDictionary.hasType(biome, BiomeDictionary.Type.OCEAN) || biome instanceof BiomeOcean){
            if (k14 > 0)
            {
                int l17 = random.nextInt(k14);
                BlockPos position = chunkPos.add(j7, l17, i11);
                
                for (IBlockState iblockstate = world.getBlockState(position); (iblockstate.getBlock().isAir(iblockstate, world, position) || iblockstate.getMaterial() == Material.WATER) && position.getY() > 0; iblockstate = world.getBlockState(position))
                {
                    position = position.down();
                }

                for (int i = 0; i < 128; ++i)
                {
                    BlockPos blockpos = position.add(random.nextInt(8) - random.nextInt(8), random.nextInt(4) - random.nextInt(4), random.nextInt(8) - random.nextInt(8));

                    if (world.getBlockState(blockpos).getBlock() == Blocks.WATER && ModBlocks.seaweed.canBlockStay(world, blockpos, ModBlocks.seaweed.getDefaultState()))
                    {
                        world.setBlockState(blockpos, ModBlocks.seaweed.getDefaultState(), 2);
                    }
                }

                return !newGen;
            }
		}
       }
	return false;
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:41,代碼來源:SeaweedFeature.java

示例13: generateFeature

import net.minecraftforge.common.BiomeDictionary; //導入方法依賴的package包/類
@Override
public boolean generateFeature(World world, Random random, int chunkX, int chunkZ, boolean newGen) {
	BlockPos chunkPos = new BlockPos(chunkX * 16, 0, chunkZ * 16);
	if (Config.coralChance > 0 && random.nextInt(Config.coralChance) == 0)
       {
           int j7 = random.nextInt(16) + 8;
           int i11 = random.nextInt(16) + 8;
           BlockPos center = chunkPos.add(j7, 0, i11);
           int k14 = world.getHeight(center).getY() * 2;

           Biome biome = world.getBiome(chunkPos);
		if(BiomeDictionary.hasType(biome, BiomeDictionary.Type.OCEAN) || biome instanceof BiomeOcean){
            if (k14 > 0)
            {
                int l17 = random.nextInt(k14);
                BlockPos position = chunkPos.add(j7, l17, i11);
                
                for (IBlockState iblockstate = world.getBlockState(position); (iblockstate.getBlock().isAir(iblockstate, world, position) || iblockstate.getMaterial() == Material.WATER) && position.getY() > 0; iblockstate = world.getBlockState(position))
                {
                    position = position.down();
                }

                BlockPos blockpos = position.add(random.nextInt(8) - random.nextInt(8), random.nextInt(4) - random.nextInt(4), random.nextInt(8) - random.nextInt(8));

                if (world.getBlockState(blockpos).getBlock() == Blocks.WATER && world.getBlockState(blockpos.down()).getMaterial() == Material.SAND)
                {
                	BlockCoral.generateCoralCluster(world, blockpos, MathHelper.getInt(random, 20, 40), false, false);
                }

                return !newGen;
            }
		}
       }
	return false;
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:36,代碼來源:CoralReefFeature.java

示例14: generateFeature

import net.minecraftforge.common.BiomeDictionary; //導入方法依賴的package包/類
@Override
public boolean generateFeature(World world, Random random, int chunkX, int chunkZ, boolean newGen) {
	if(!Config.generateRoses) return false;
	BlockPos chunkPos = new BlockPos(chunkX * 16, 0, chunkZ * 16);
	if(random.nextInt(5) == 0)
       {
		int l = random.nextInt(16) + 8;
		int i1 = random.nextInt(16) + 8;
		BlockPos pos = chunkPos.add(l, 0, i1);
		int j1 = random.nextInt(world.getHeight(pos).getY() + 32);
		Biome biome = world.getBiomeForCoordsBody(pos);
		if(biome == Biomes.FOREST || BiomeDictionary.hasType(biome, Type.FOREST)){
			boolean flag = false;
			BlockPos position = new BlockPos(chunkPos.getX() + l, j1, chunkPos.getZ() + i1);
			
			for (int i = 0; i < 64; ++i)
			{
				BlockPos blockpos = position.add(random.nextInt(8) - random.nextInt(8), random.nextInt(4) - random.nextInt(4), random.nextInt(8) - random.nextInt(8));

				if (world.isAirBlock(blockpos) && (!world.provider.hasNoSky() || blockpos.getY() < 254) && ModBlocks.roseBush.canPlaceBlockAt(world, blockpos))
				{
					RoseType[] normalTypes = {RoseType.ORANGE, RoseType.MAGENTA, RoseType.YELLOW, RoseType.PINK, RoseType.CYAN, RoseType.PURPLE}; //Normal Colors
					RoseType roseType = normalTypes[MathHelper.getInt(random, 0, 5)]; //Choose a random color in the list
					if(random.nextInt(100) <= 12){ //12% chance
					    roseType = RoseType.WHITE; //Yay! White!
					}
					world.setBlockState(blockpos, ModBlocks.roseBush.getDefaultState().withProperty(BlockBetterRoses.COLOR, roseType), 2);
					world.setBlockState(blockpos.up(), ModBlocks.roseBush.getDefaultState().withProperty(BlockBetterRoses.COLOR, roseType).withProperty(BlockBetterRoses.TOP, true), 2);
			    	flag = true;
				}
			}
			return !newGen && flag;
		}
       }
	return false;
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:37,代碼來源:RoseBushFeature.java

示例15: generateFeature

import net.minecraftforge.common.BiomeDictionary; //導入方法依賴的package包/類
@Override
public boolean generateFeature(World world, Random random, int chunkX, int chunkZ, boolean newGen) {
	BlockPos chunkPos = new BlockPos(chunkX * 16, 0, chunkZ * 16);
	if (random.nextInt(30) == 0)
	{
		int j9 = random.nextInt(16) + 8;
		int i13 = random.nextInt(16) + 8;
		BlockPos center = world.getHeight(chunkPos.add(j9, 0, i13));
		Biome biome = world.getBiome(center);
		if(BiomeDictionary.hasType(biome, BiomeDictionary.Type.FOREST) || biome instanceof BiomeForest){
			boolean placed = false;
			for (int i = 0; i < 24; ++i)
			{
				int range = 4;
				BlockPos bushPos = center.add(MathHelper.getInt(random, -range, range), MathHelper.getInt(random, -4, 4), MathHelper.getInt(random, -range, range));
				if (world.isAirBlock(bushPos.down()) && ModBlocks.crystalBush.canPlaceBlockAt(world, bushPos.down()))
				{
					int type = MathHelper.getInt(random, 0, PlantType.values().length-1);
					int age = MathHelper.getInt(random, 0, 3);
					IBlockState state = ModBlocks.crystalBush.getDefaultState().withProperty(BlockCrystalBerryBush.AGE, age).withProperty(BlockCrystalBerryBush.TYPE, PlantType.values()[type]);
					world.setBlockState(bushPos.down(), state);
					placed = true;
				}
			}
			return placed && !newGen;
		}
	}
	return false;
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:30,代碼來源:CrystalBushFeature.java


注:本文中的net.minecraftforge.common.BiomeDictionary.hasType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。