Java 类net.minecraft.world.biome.BiomeOcean 实例源码

项目:CrystalMod    文件:SeaweedFeature.java   
@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;
}
项目:CrystalMod    文件:CoralReefFeature.java   
@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;
}
项目:geomastery    文件:BlockCropHarvestable.java   
@Override
public boolean isPermitted(Biome biome) {

    return biome instanceof BiomeForest || biome == Biomes.RIVER ||
            biome instanceof BiomeOcean ||
            biome instanceof BiomePlains ||
            biome instanceof BiomeJungle ||
            biome instanceof BiomeSavanna;
}
项目:geomastery    文件:BlockCrop.java   
@Override
public boolean isPermitted(Biome biome) {

    return biome instanceof BiomeOcean || biome == Biomes.RIVER ||
            biome instanceof BiomeBeach ||
            biome instanceof BiomeForest ||
            biome instanceof BiomePlains ||
            biome instanceof BiomeJungle;
}
项目:geomastery    文件:BlockCrop.java   
@Override
public boolean isPermitted(Biome biome) {

    return biome == Biomes.RIVER || biome instanceof BiomeOcean ||
            biome instanceof BiomeForest ||
            biome instanceof BiomePlains ||
            biome instanceof BiomeJungle ||
            biome instanceof BiomeSavanna;
}
项目:geomastery    文件:BlockSeedling.java   
@Override
public boolean isPermitted(Biome biome) {

    return biome instanceof BiomeForest ||
            biome instanceof BiomeOcean ||
            biome instanceof BiomePlains || biome == Biomes.RIVER ||
            biome instanceof BiomeJungle ||
            biome instanceof BiomeSavanna;
}
项目:geomastery    文件:BlockBeehive.java   
@Override
public boolean isPermitted(Biome biome) {

    return biome instanceof BiomeForest || biome instanceof BiomeOcean ||
            biome == Biomes.RIVER || biome instanceof BiomePlains ||
            biome == Biomes.BEACH || biome instanceof BiomeSwamp ||
            biome instanceof BiomeMushroomIsland ||
            biome instanceof BiomeJungle || biome instanceof BiomeSavanna;
}
项目:CrystalMod    文件:KelpFeature.java   
@Override
public boolean generateFeature(World world, Random random, int chunkX, int chunkZ, boolean newGen) {
    if(!Config.generateKelp)return false;

    BlockPos chunkPos = new BlockPos(chunkX * 16, 0, chunkZ * 16);
    if(random.nextInt(5) == 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();
                }
                boolean placed = false;
                for (int i = 0; i < 125; ++i)
                {
                    BlockPos blockpos = position.add(random.nextInt(4) - random.nextInt(4), random.nextInt(4) - random.nextInt(4), random.nextInt(4) - random.nextInt(4));

                    if (world.getBlockState(blockpos).getBlock() == Blocks.WATER && ModBlocks.kelp.canBlockStay(world, blockpos, ModBlocks.kelp.getDefaultState()) && world.getBlockState(blockpos.down()).getMaterial() == Material.SAND)
                    {
                        if(generateKelp(world, blockpos, random)){
                            placed = true;
                        }
                    }
                }

                return !newGen && placed;
            }
        }
       }
    return false;
}
项目:geomastery    文件:GeoBiomes.java   
/** Assigns a temperature to the biome.
 * @return The base temperature for the biome */
private static float chooseTemp(Biome biome) {

    if (biome == Biomes.MUTATED_ICE_FLATS) {

        return -4;

    } else if (biome instanceof BiomeSnow) {

        return -3;

    } else if (biome == Biomes.FROZEN_RIVER) {

        return -2;

    } else if (biome == Biomes.COLD_TAIGA ||
            biome == Biomes.COLD_TAIGA_HILLS ||
            biome == Biomes.MUTATED_TAIGA_COLD) {

        return -1;

    } else if (biome == Biomes.COLD_BEACH) {

        return -0.5F;

    } else if (biome instanceof BiomeHills || biome instanceof BiomeTaiga ||
            biome instanceof BiomeVoid || biome instanceof BiomeEnd) {

        return 0;

    } else if (biome == Biomes.STONE_BEACH) {

        return 0.5F;

    } else if (biome == Biomes.BIRCH_FOREST ||
            biome == Biomes.BIRCH_FOREST_HILLS) {

        return 1;

    } else if (biome instanceof BiomeOcean || biome instanceof BiomeForest
            || biome instanceof BiomeRiver) {

        return 2;

    } else if (biome instanceof BiomePlains) {

        return 2.5F;

    } else if (biome instanceof BiomeSwamp || biome instanceof BiomeBeach) {

        return 3;

    } else if (biome instanceof BiomeMushroomIsland) {

        return 4;

    } else if (biome instanceof BiomeJungle) {

        return 4.5F;

    } else if (biome instanceof BiomeSavanna) {

        return 5;

    } else if (biome instanceof BiomeDesert || biome instanceof BiomeMesa ||
            biome instanceof BiomeHell) {

        return 6;

    } else {

        float base = biome.getTemperature();
        float converted = (base - 1) * 10;
        Geomastery.LOG.info("Unsupported biome {} has had its temperature set to {}", biome.getBiomeName(), converted);
        return converted;
    }
}