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

项目:CustomWorldGen    文件:GameData.java   
public GameData()
{
    iBlockRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.BLOCKS, Block.class, new ResourceLocation("minecraft:air"), MIN_BLOCK_ID, MAX_BLOCK_ID, true, BlockCallbacks.INSTANCE, BlockCallbacks.INSTANCE, BlockCallbacks.INSTANCE, BlockCallbacks.INSTANCE);
    iItemRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.ITEMS, Item.class, null, MIN_ITEM_ID, MAX_ITEM_ID, true, ItemCallbacks.INSTANCE, ItemCallbacks.INSTANCE, ItemCallbacks.INSTANCE, ItemCallbacks.INSTANCE);
    iPotionRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.POTIONS, Potion.class, null, MIN_POTION_ID, MAX_POTION_ID, false, PotionCallbacks.INSTANCE, PotionCallbacks.INSTANCE, PotionCallbacks.INSTANCE, null);
    iBiomeRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.BIOMES, Biome.class, null, MIN_BIOME_ID, MAX_BIOME_ID, false, BiomeCallbacks.INSTANCE, BiomeCallbacks.INSTANCE, BiomeCallbacks.INSTANCE, null);
    iSoundEventRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.SOUNDEVENTS, SoundEvent.class, null, MIN_SOUND_ID, MAX_SOUND_ID, false, null, null, null, null);
    ResourceLocation WATER = new ResourceLocation("water");
    iPotionTypeRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.POTIONTYPES, PotionType.class, WATER, MIN_POTIONTYPE_ID, MAX_POTIONTYPE_ID, false, null, null, null, null);
    iEnchantmentRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.ENCHANTMENTS, Enchantment.class, null, MIN_ENCHANTMENT_ID, MAX_ENCHANTMENT_ID, false, null, null, null, null);

    try
    {
        blockField = FinalFieldHelper.makeWritable(ReflectionHelper.findField(ItemBlock.class, "block", "field_150939" + "_a"));
    }
    catch (Exception e)
    {
        FMLLog.log(Level.FATAL, e, "Cannot access the 'block' field from ItemBlock, this is fatal!");
        throw Throwables.propagate(e);
    }
}
项目:Backmemed    文件:ChunkProviderHell.java   
public List<Biome.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos)
{
    if (creatureType == EnumCreatureType.MONSTER)
    {
        if (this.genNetherBridge.isInsideStructure(pos))
        {
            return this.genNetherBridge.getSpawnList();
        }

        if (this.genNetherBridge.isPositionInStructure(this.world, pos) && this.world.getBlockState(pos.down()).getBlock() == Blocks.NETHER_BRICK)
        {
            return this.genNetherBridge.getSpawnList();
        }
    }

    Biome biome = this.world.getBiome(pos);
    return biome.getSpawnableList(creatureType);
}
项目:Firma    文件:FirmaChunkGen.java   
@Override
public Chunk provideChunk(int x, int z) {

    this.rand.setSeed(x * 341873128712L + z * 132897987541L);
    ChunkPrimer chunkprimer = new ChunkPrimer();
    this.setBlocksInChunk(x, z, chunkprimer);
    Biome[] biomesForGeneration = this.replaceBiomeBlocks(x, z, chunkprimer);
    this.caveGenerator.generate(this.world, x, z, chunkprimer);
    this.ravineGenerator.generate(world, x, z, chunkprimer);
    Chunk chunk = new Chunk(this.world, chunkprimer, x, z);
    byte[] abyte = chunk.getBiomeArray();

    for (int i = 0; i < abyte.length; i++) {
        abyte[i] = (byte) Biome.getIdForBiome(biomesForGeneration[i + 19]);
    }
    chunk.setBiomeArray(abyte);
    chunk.generateSkylightMap();

    return chunk;
}
项目:Backmemed    文件:StructureVillagePieces.java   
public Start(BiomeProvider chunkManagerIn, int p_i2104_2_, Random rand, int p_i2104_4_, int p_i2104_5_, List<StructureVillagePieces.PieceWeight> p_i2104_6_, int p_i2104_7_)
{
    super((StructureVillagePieces.Start)null, 0, rand, p_i2104_4_, p_i2104_5_);
    this.worldChunkMngr = chunkManagerIn;
    this.structureVillageWeightedPieceList = p_i2104_6_;
    this.terrainType = p_i2104_7_;
    Biome biome = chunkManagerIn.getBiome(new BlockPos(p_i2104_4_, 0, p_i2104_5_), Biomes.DEFAULT);

    if (biome instanceof BiomeDesert)
    {
        this.structureType = 1;
    }
    else if (biome instanceof BiomeSavanna)
    {
        this.structureType = 2;
    }
    else if (biome instanceof BiomeTaiga)
    {
        this.structureType = 3;
    }

    this.func_189924_a(this.structureType);
    this.isZombieInfested = rand.nextInt(50) == 0;
}
项目:Firma    文件:Layer.java   
public static void prep() {
    OCEAN = Biome.getIdForBiome(FirmaBiome.OCEAN);
    DOCEAN = Biome.getIdForBiome(FirmaBiome.DEEPOCEAN);
    LAKE = Biome.getIdForBiome(FirmaBiome.LAKE);
    RIVER = Biome.getIdForBiome(FirmaBiome.RIVER);
    PLAINS = Biome.getIdForBiome(FirmaBiome.PLAINS);
    HILLS = Biome.getIdForBiome(FirmaBiome.HILLS);
    EXHILLS = Biome.getIdForBiome(FirmaBiome.EXHILLS);
    HILLSEDGE = Biome.getIdForBiome(FirmaBiome.HILLSEDGE);
    EXHILLSEDGE = Biome.getIdForBiome(FirmaBiome.EXHILLSEDGE);
    SWAMP = Biome.getIdForBiome(FirmaBiome.SWAMP);
    BEACH = Biome.getIdForBiome(FirmaBiome.BEACH);
    GBEACH = Biome.getIdForBiome(FirmaBiome.GRAVELBEACH);
    FOREST = Biome.getIdForBiome(FirmaBiome.FOREST);

}
项目:Firma    文件:FirmaGenLayerBiome.java   
/**
 * Takes Continent data (only 0's and 1's) and for anything not ocean it throws any of the allowed biomes back. Can't help but wonder if I could do better than "Any of allowed" and possibly have hills mostly in-land etc. Will have to see
 */
@Override
public int[] getInts(int x, int y, int w, int h)
{
    int[] parentInts = this.parent.getInts(x, y, w, h);
    int[] newInts = IntCache.getIntCache(w * h);

    for (int currentX = 0; currentX < h; ++currentX)
    {
        for (int currentY = 0; currentY < w; ++currentY)
        {
            this.initChunkSeed(currentY + x, currentX + y);
            int id = parentInts[currentY + currentX * w];
            newInts[currentY+currentX*w]=id;
            if (id==0){
                newInts[currentY + currentX * w] = Layer.OCEAN;
            }else if(id==Layer.DOCEAN){
                continue;
            }else{ 
                newInts[currentY + currentX * w] = Biome.getIdForBiome(this.allowedBiomes[this.nextInt(this.allowedBiomes.length)]);
            }
        }
    }
    validateIntArray(newInts, w, h);
    return newInts;
}
项目:modName    文件:BiomeTropicalShrubland.java   
public BiomeTropicalShrubland() {
    super(new Biome.BiomeProperties("Tropical Shrubland")
            .setBaseHeight(0.105f)
            .setHeightVariation(0.15f)
            .setTemperature(1.1f)
            .setRainfall(0.45f)
    );

    this.setRegistryName(Ref.MODID+":tropical_shrubland");
    this.decorator.treesPerChunk = 5;
    this.decorator.grassPerChunk = 10;
    this.decorator.flowersPerChunk = 4;

    this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityChicken.class, 5, 4, 4));
    Ref.BIOMES.add(this);
}
项目:harshencastle    文件:PontusBiomeDecorator.java   
@Override
protected void genDecorations(Biome biomeIn, World worldIn, Random random) {

        int k1 = this.treesPerChunk;
        if (random.nextFloat() < this.extraTreeChance)
        {
            ++k1;
        }

        if(net.minecraftforge.event.terraingen.TerrainGen.decorate(worldIn, random, chunkPos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.TREE))
        for (int j2 = 0; j2 < k1; ++j2)
        {
            int k6 = random.nextInt(16) + 8;
            int l = random.nextInt(16) + 8;
            WorldGenAbstractTree worldgenabstracttree = biomeIn.getRandomTreeFeature(random);
            worldgenabstracttree.setDecorationDefaults();
            BlockPos blockpos = worldIn.getHeight(this.chunkPos.add(k6, 0, l));

            if (worldgenabstracttree.generate(worldIn, random, blockpos))
            {
                worldgenabstracttree.generateSaplings(worldIn, random, blockpos);
            }
        }
}
项目:CustomWorldGen    文件:GenLayerBiomeEdge.java   
/**
 * Returns if two biomes can logically be neighbors. If one is hot and the other cold, for example, it returns
 * false.
 */
private boolean canBiomesBeNeighbors(int p_151634_1_, int p_151634_2_)
{
    if (biomesEqualOrMesaPlateau(p_151634_1_, p_151634_2_))
    {
        return true;
    }
    else
    {
        Biome biome = Biome.getBiome(p_151634_1_);
        Biome biome1 = Biome.getBiome(p_151634_2_);

        if (biome != null && biome1 != null)
        {
            Biome.TempCategory biome$tempcategory = biome.getTempCategory();
            Biome.TempCategory biome$tempcategory1 = biome1.getTempCategory();
            return biome$tempcategory == biome$tempcategory1 || biome$tempcategory == Biome.TempCategory.MEDIUM || biome$tempcategory1 == Biome.TempCategory.MEDIUM;
        }
        else
        {
            return false;
        }
    }
}
项目:Backmemed    文件:WorldProvider.java   
/**
 * creates a new world chunk manager for WorldProvider
 */
protected void createBiomeProvider()
{
    this.field_191067_f = true;
    WorldType worldtype = this.worldObj.getWorldInfo().getTerrainType();

    if (worldtype == WorldType.FLAT)
    {
        FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.createFlatGeneratorFromString(this.worldObj.getWorldInfo().getGeneratorOptions());
        this.biomeProvider = new BiomeProviderSingle(Biome.getBiome(flatgeneratorinfo.getBiome(), Biomes.DEFAULT));
    }
    else if (worldtype == WorldType.DEBUG_WORLD)
    {
        this.biomeProvider = new BiomeProviderSingle(Biomes.PLAINS);
    }
    else
    {
        this.biomeProvider = new BiomeProvider(this.worldObj.getWorldInfo());
    }
}
项目:InControl    文件:ForgeEventHandlers.java   
@SubscribeEvent
public void onPotentialSpawns(WorldEvent.PotentialSpawns event) {
    int i = 0;
    for (PotentialSpawnRule rule : RulesManager.potentialSpawnRules) {
        if (rule.match(event)) {

            // First remove mob entries if needed
            for (Class clazz : rule.getToRemoveMobs()) {
                for (int idx = event.getList().size()-1 ; idx >= 0 ; idx--) {
                    if (event.getList().get(idx).entityClass == clazz) {
                        event.getList().remove(idx);
                    }
                }
            }

            List<Biome.SpawnListEntry> spawnEntries = rule.getSpawnEntries();
            for (Biome.SpawnListEntry entry : spawnEntries) {
                if (debug) {
                    InControl.logger.log(Level.INFO, "Potential " + i + ": "+ entry.entityClass.toString());
                }
                event.getList().add(entry);
            }
        }
        i++;
    }
}
项目:minecraft-hue    文件:EventListener.java   
@SubscribeEvent
public void onLivingUpdate(LivingEvent.LivingUpdateEvent event) {
    if (!(event.getEntity() instanceof EntityPlayer)) {
        return;
    }
    EntityPlayer player = (EntityPlayer) event.getEntity();
    if (player.isDead) {
        this.hueManager.adjustColor(new Color(255, 0, 0));
        return;
    }
    BlockPos pos = player.getPosition();
    Chunk chunk = this.world.getChunkFromBlockCoords(pos);
    Biome biome = chunk.getBiome(pos, this.world.getBiomeProvider());
    String color = this.biomeMap.get(biome.getRegistryName().getResourcePath());
    if (color != null) {
        this.hueManager.adjustColor(color);
    }
}
项目:modName    文件:BiomeProviderATG.java   
public Biome getBestBiome(int x, int z) {
    double weight = Double.MIN_VALUE;
    BiomeGroup bestGroup = null;

    Map<BiomeGroup,Double> weights = getBiomeWeights(x,z, this.noise);

    double w;
    for (BiomeGroup b : weights.keySet()) {
        w = weights.get(b);
        if (w > weight) {
            bestGroup = b;
            weight = w;
        }
    }

    if (bestGroup == null) {
        return Biomes.DEFAULT;
    }

    return getSubBiomeForPosition(x,z, bestGroup);
}
项目:modName    文件:BiomeShrubland.java   
public BiomeShrubland() {
    super(new BiomeProperties("Shrubland")
            .setBaseHeight(0.115f)
            .setHeightVariation(0.1f)
            .setTemperature(0.77f)
            .setRainfall(0.53f)
    );

    this.setRegistryName(Ref.MODID+":shrubland");
    this.decorator.treesPerChunk = 1;
    this.decorator.grassPerChunk = 7;
    this.decorator.flowersPerChunk = 3;

    this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityHorse.class, 2, 2, 4));
    Ref.BIOMES.add(this);
}
项目:Backmemed    文件:CustomColormap.java   
private int getColorGrid(Biome p_getColorGrid_1_, BlockPos p_getColorGrid_2_)
{
    int i = Biome.getIdForBiome(p_getColorGrid_1_);
    int j = p_getColorGrid_2_.getY() - this.yOffset;

    if (this.yVariance > 0)
    {
        int k = p_getColorGrid_2_.getX() << 16 + p_getColorGrid_2_.getZ();
        int l = Config.intHash(k);
        int i1 = this.yVariance * 2 + 1;
        int j1 = (l & 255) % i1 - this.yVariance;
        j += j1;
    }

    return this.getColor(i, j);
}
项目:Backmemed    文件:Bootstrap.java   
/**
 * Registers blocks, items, stats, etc.
 */
public static void register()
{
    if (!alreadyRegistered)
    {
        alreadyRegistered = true;
        redirectOutputToLog();
        SoundEvent.registerSounds();
        Block.registerBlocks();
        BlockFire.init();
        Potion.registerPotions();
        Enchantment.registerEnchantments();
        Item.registerItems();
        PotionType.registerPotionTypes();
        PotionHelper.init();
        EntityList.init();
        StatList.init();
        Biome.registerBiomes();
        registerDispenserBehaviors();
    }
}
项目:TechReborn3    文件:CommandTechRebornTest.java   
public static BlockPos spiralOutwardsLookingForBiome(World world, Biome biomeToFind, double startX, double startZ, int maxDist, int sampleSpace) {
    double a = sampleSpace / Math.sqrt(Math.PI);
    double b = 2 * Math.sqrt(Math.PI);
    double x;
    double z;
    double dist = 0;
    int n;
    for (n = 0; dist < maxDist; ++n) {
        double rootN = Math.sqrt(n);
        dist = a * rootN;
        x = startX + (dist * Math.sin(b * rootN));
        z = startZ + (dist * Math.cos(b * rootN));
        if (world.getBiome(new BlockPos(x, 0, z)).getRegistryName().getResourceDomain().equals(TRConstants.MOD_ID)) {
            return new BlockPos((int) x, 0, (int) z);
        }
    }
    return null;
}
项目:modName    文件:BiomeProviderATG.java   
@Override
public Biome[] getBiomesForGeneration(Biome[] biomes, int x, int z, int width, int height)
{
    IntCache.resetIntCache();

    if (biomes == null || biomes.length < width * height)
    {
        biomes = new Biome[width * height];
    }

    int ix,iz,bx,bz;
    for (ix = 0; ix < width; ++ix) {
        for (iz = 0; iz < height; ++iz) {
            bx = x + ix;
            bz = z + iz;

            biomes[iz*width + ix] = getBestBiome(bx,bz);
        }
    }

    return biomes;
}
项目:modName    文件:ChunkProviderBasic.java   
@Override
public List<Biome.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) {
    Biome biome = this.world.getBiome(pos);

    for (MapGenStructure structure : this.structureGenerators)
    {
        if (this.featureSpawnListActions.containsKey(structure)) {
            List<Biome.SpawnListEntry> list = this.featureSpawnListActions.get(structure).apply(structure, creatureType, pos);
            if (list != null) {
                return list;
            }
        }
    }

    return biome.getSpawnableList(creatureType);
}
项目:modName    文件:BiomeRegistry.java   
public Biome getSubBiome(Biome parent, double value) {
    if (!this.subBiomes.containsKey(parent)) {
        return parent;
    }

    double weight = MathUtil.clamp(value, 0.0, 1.0) * (this.subWeightTotals.get(parent) + 1.0);

    if (weight <= 1.0) {
        return parent;
    }

    weight -= 1.0;

    Map<Biome, Double> weights = this.subBiomes.get(parent);

    double total = 0.0;
    for (Map.Entry<Biome, Double> entry : weights.entrySet()) {
        total += entry.getValue();
        if (total >= weight) {
            return entry.getKey();
        }
    }

    return null; // shouldn't happen!
}
项目:modName    文件:BiomeRegistry.java   
public Biome getHillBiome(Biome parent, CoreNoise noise, int x, int z) {
    if (!this.hillBiomes.containsKey(parent)) {
        return parent;
    }

    Map<Biome, Double> hills = this.hillBiomes.get(parent);

    double height = noise.getHeight(x,z) + noise.getRoughness(x,z) * 0.1;

    Biome biome = parent;

    for (Map.Entry<Biome,Double> e : hills.entrySet()) {
        if (height > e.getValue()) {
            biome = e.getKey();
        } else {
            return biome;
        }
    }

    return biome;
}
项目:Backmemed    文件:GuiFlatPresets.java   
private static void registerPreset(String name, Item icon, int iconMetadata, Biome biome, List<String> features, FlatLayerInfo... layers)
{
    FlatGeneratorInfo flatgeneratorinfo = new FlatGeneratorInfo();

    for (int i = layers.length - 1; i >= 0; --i)
    {
        flatgeneratorinfo.getFlatLayers().add(layers[i]);
    }

    flatgeneratorinfo.setBiome(Biome.getIdForBiome(biome));
    flatgeneratorinfo.updateLayers();

    for (String s : features)
    {
        flatgeneratorinfo.getWorldFeatures().put(s, Maps.<String, String>newHashMap());
    }

    FLAT_WORLD_PRESETS.add(new GuiFlatPresets.LayerItem(icon, iconMetadata, name, flatgeneratorinfo.toString()));
}
项目:ExPetrum    文件:ExPBiomeDecorator.java   
public void tallgrassPassGenerate(World worldIn, Random rand, Biome biome, BlockPos pos)
{
    int x = rand.nextInt(16) + 8;
    int z = rand.nextInt(16) + 8;
    BlockPos at = worldIn.getHeight(pos.add(x, 0, z));
    EventGenVegetation event = new EventGenVegetation(worldIn, at, rand, genVegetation, Type.TALLGRASS);
    if (MinecraftForge.TERRAIN_GEN_BUS.post(event))
    {
        return;
    }

    event.generator.generate(worldIn, rand, at);
}
项目:ExPetrum    文件:ExPBiomeRegistry.java   
public void registerBiomes(RegistryEvent.Register<Biome> event)
{
    IForgeRegistry<Biome> registry = event.getRegistry();
    registryEntries = Arrays.asList(
            ExPRiver.create(),
            ExPOcean.create(),
            ExPBeach.create(),
            ExPPlains.create(),
            ExPForest.create(),
            ExPMountains.create(),
            ExPColdPlains.create(),
            ExPColdForest.create(),
            ExPWarmPlains.create(),
            ExPWarmForest.create(),
            ExPDenseForest.create(),
            ExPDenseColdForest.create(),
            ExPDenseWarmForest.create(),
            ExPLake.create(),
            ExPJungle.create(),
            ExPDesert.create(),
            ExPRareForest.create(),
            ExPHills.create(),
            ExPSavanna.create()
    );

    registryEntries.forEach(registry::register);
    registryEntries.stream().filter(e -> e instanceof IDictionariedBiome).map(e -> (IDictionariedBiome)e).forEach(IDictionariedBiome::registerTypes);
}
项目:modName    文件:BiomeProviderATG.java   
@Override
public boolean areBiomesViable(int x, int z, int radius, List<Biome> allowed)
{
    IntCache.resetIntCache();
    int xmin = x - (radius >> 2);
    int zmin = z - (radius >> 2);
    int xmax = x + (radius >> 2);
    int zmax = z + (radius >> 2);
    int xdiff = xmax - xmin + 1;
    int zdiff = zmax - zmin + 1;
    Biome[] biomes = this.getBiomes(null, xmin,zmin,xdiff,zdiff, true);

    try
    {
        for (int index = 0; index < xdiff * zdiff; ++index)
        {
            if (!allowed.contains(biomes[index]))
            {
                return false;
            }
        }

        return true;
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Layer");
        crashreportcategory.addCrashSection("x", Integer.valueOf(x));
        crashreportcategory.addCrashSection("z", Integer.valueOf(z));
        crashreportcategory.addCrashSection("radius", Integer.valueOf(radius));
        crashreportcategory.addCrashSection("allowed", allowed);
        throw new ReportedException(crashreport);
    }
}
项目:Backmemed    文件:World.java   
/**
 * Checks to see if a given block is both water and cold enough to freeze.
 */
public boolean canBlockFreeze(BlockPos pos, boolean noWaterAdj)
{
    Biome biome = this.getBiome(pos);
    float f = biome.getFloatTemperature(pos);

    if (f >= 0.15F)
    {
        return false;
    }
    else
    {
        if (pos.getY() >= 0 && pos.getY() < 256 && this.getLightFor(EnumSkyBlock.BLOCK, pos) < 10)
        {
            IBlockState iblockstate = this.getBlockState(pos);
            Block block = iblockstate.getBlock();

            if ((block == Blocks.WATER || block == Blocks.FLOWING_WATER) && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0)
            {
                if (!noWaterAdj)
                {
                    return true;
                }

                boolean flag = this.isWater(pos.west()) && this.isWater(pos.east()) && this.isWater(pos.north()) && this.isWater(pos.south());

                if (!flag)
                {
                    return true;
                }
            }
        }

        return false;
    }
}
项目:Firma    文件:FirmaTreeGen.java   
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    byte b = world.getChunkFromChunkCoords(chunkX, chunkZ).getBiomeArray()[0];
    FirmaTree[] tl = FirmaBiome.getTreeForBiome(b, chunkZ*16);
    if(tl.length==0){ return; }
    FirmaTree ft = tl[random.nextInt(tl.length)];
    FirmaBiome bi = (FirmaBiome) Biome.getBiome(b);
    for(int i = 0; i < bi.treeCount; i++){
        ft.generate(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider);
    }
}
项目:CustomWorldGen    文件:DeferredBiomeDecorator.java   
@Override
public void decorate(World par1World, Random par2Random, Biome biome, BlockPos pos)
{
    fireCreateEventAndReplace(biome);
    // On first call to decorate, we fire and substitute ourselves, if we haven't already done so
    biome.theBiomeDecorator.decorate(par1World, par2Random, biome, pos);
}
项目:CustomWorldGen    文件:BiomeManager.java   
public static void addSpawnBiome(Biome biome)
{
    if (!BiomeProvider.allowedBiomes.contains(biome))
    {
        BiomeProvider.allowedBiomes.add(biome);
    }
}
项目:ExPetrum    文件:ExPBiomeDecorator.java   
public void doTreePass(World worldIn, Random random, Biome biome, BlockPos pos)
{
    for (int i = 0; i < this.treesPerChunk; ++i)
    {
        treePassGenerate(worldIn, random, biome, pos);
    }

    if (random.nextDouble() <= this.extraTreeChance)
    {
        treePassGenerate(worldIn, random, biome, pos);
    }
}
项目:ExPetrum    文件:ExPBiomeDecorator.java   
public void pebblePassGenerate(World worldIn, Random rand, Biome biome, BlockPos pos)
{
    int x = rand.nextInt(16) + 8;
    int z = rand.nextInt(16) + 8;
    BlockPos at = worldIn.getHeight(pos.add(x, 0, z));
    EventGenPebble event = new EventGenPebble(worldIn, at, rand, genPebble);
    if (MinecraftForge.TERRAIN_GEN_BUS.post(event))
    {
        return;
    }

    event.generator.generate(worldIn, rand, at);
}
项目:Firma    文件:FirmaGenLayer.java   
public void validateIntArray(int[] array, int xSize, int zSize) {
    for (int z = 0; z < zSize; z++) {
        for (int x = 0; x < xSize; x++) {
            int id = array[x + z * xSize];
            Biome b = Biome.getBiomeForId(id);
            if (!(b instanceof FirmaBiome)) {
                System.out.println(this.getClass() + " // Error Array garbage data: " + array[x + z * xSize]);
                throw new RuntimeException(id + " " + b.getBiomeName() + " Not Firma Biome");
                // return;
            }
        }
    }
}
项目:CustomWorldGen    文件:World.java   
public boolean canSnowAtBody(BlockPos pos, boolean checkLight)
{
    Biome biome = this.getBiome(pos);
    float f = biome.getFloatTemperature(pos);

    if (f > 0.15F)
    {
        return false;
    }
    else if (!checkLight)
    {
        return true;
    }
    else
    {
        if (pos.getY() >= 0 && pos.getY() < 256 && this.getLightFor(EnumSkyBlock.BLOCK, pos) < 10)
        {
            IBlockState iblockstate = this.getBlockState(pos);

            if (iblockstate.getBlock().isAir(iblockstate, this, pos) && Blocks.SNOW_LAYER.canPlaceBlockAt(this, pos))
            {
                return true;
            }
        }

        return false;
    }
}
项目:CustomWorldGen    文件:World.java   
public boolean canBlockFreezeBody(BlockPos pos, boolean noWaterAdj)
{
    Biome biome = this.getBiome(pos);
    float f = biome.getFloatTemperature(pos);

    if (f > 0.15F)
    {
        return false;
    }
    else
    {
        if (pos.getY() >= 0 && pos.getY() < 256 && this.getLightFor(EnumSkyBlock.BLOCK, pos) < 10)
        {
            IBlockState iblockstate = this.getBlockState(pos);
            Block block = iblockstate.getBlock();

            if ((block == Blocks.WATER || block == Blocks.FLOWING_WATER) && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0)
            {
                if (!noWaterAdj)
                {
                    return true;
                }

                boolean flag = this.isWater(pos.west()) && this.isWater(pos.east()) && this.isWater(pos.north()) && this.isWater(pos.south());

                if (!flag)
                {
                    return true;
                }
            }
        }

        return false;
    }
}
项目:ExPetrum    文件:WorldTypeExP.java   
@Override
public Biome[] getBiomesForGeneration(Biome[] biomes, int x, int z, int width, int height)
   {
       IntCache.resetIntCache();

       if (biomes == null || biomes.length < width * height)
       {
           biomes = new Biome[width * height];
       }

       int[] aint = this.genBiomes.getInts(x, z, width, height);

       try
       {
           for (int i = 0; i < width * height; ++i)
           {
               biomes[i] = swapHackBiome(Biome.getBiome(aint[i], Biomes.DEFAULT));
           }

           return biomes;
       }
       catch (Throwable throwable)
       {
           CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id");
           CrashReportCategory crashreportcategory = crashreport.makeCategory("RawBiomeBlock");
           crashreportcategory.addCrashSection("biomes[] size", biomes.length);
           crashreportcategory.addCrashSection("x", x);
           crashreportcategory.addCrashSection("z", z);
           crashreportcategory.addCrashSection("w", width);
           crashreportcategory.addCrashSection("h", height);
           throw new ReportedException(crashreport);
       }
   }
项目:Backmemed    文件:World.java   
public Biome getBiome(final BlockPos pos)
{
    if (this.isBlockLoaded(pos))
    {
        Chunk chunk = this.getChunkFromBlockCoords(pos);

        try
        {
            return chunk.getBiome(pos, this.provider.getBiomeProvider());
        }
        catch (Throwable throwable)
        {
            CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Getting biome");
            CrashReportCategory crashreportcategory = crashreport.makeCategory("Coordinates of biome request");
            crashreportcategory.setDetail("Location", new ICrashReportDetail<String>()
            {
                public String call() throws Exception
                {
                    return CrashReportCategory.getCoordinateInfo(pos);
                }
            });
            throw new ReportedException(crashreport);
        }
    }
    else
    {
        return this.provider.getBiomeProvider().getBiome(pos, Biomes.PLAINS);
    }
}
项目:CustomWorldGen    文件:BiomeManager.java   
public static void removeSpawnBiome(Biome biome)
{
    if (BiomeProvider.allowedBiomes.contains(biome))
    {
        BiomeProvider.allowedBiomes.remove(biome);
    }
}
项目:UniversalRemote    文件:WorldProviderProxyClient.java   
@Override
public Biome getBiomeForCoords(BlockPos pos) {
    if(m_realProvider != null) {
        return m_realProvider.getBiomeForCoords(pos);
    } else {
        return super.getBiomeForCoords(pos);
    }
}
项目:CustomWorldGen    文件:ChunkProviderOverworld.java   
public void replaceBiomeBlocks(int x, int z, ChunkPrimer primer, Biome[] biomesIn)
{
    if (!net.minecraftforge.event.ForgeEventFactory.onReplaceBiomeBlocks(this, x, z, primer, this.worldObj)) return;
    double d0 = 0.03125D;
    this.depthBuffer = this.surfaceNoise.getRegion(this.depthBuffer, (double)(x * 16), (double)(z * 16), 16, 16, 0.0625D, 0.0625D, 1.0D);

    for (int i = 0; i < 16; ++i)
    {
        for (int j = 0; j < 16; ++j)
        {
            Biome biome = biomesIn[j + i * 16];
            biome.genTerrainBlocks(this.worldObj, this.rand, primer, x * 16 + i, z * 16 + j, this.depthBuffer[j + i * 16]);
        }
    }
}
项目:modName    文件:BiomeRegistry.java   
public Biome getBiome(double value) {
    double weight = MathUtil.clamp(value,0.0,1.0) * this.totalweight;

    double total = 0.0;
    for (Map.Entry<Biome, Double> entry : this.biomes.entrySet()) {
        total += entry.getValue();
        if (total >= weight) {
            return entry.getKey();
        }
    }

    return null; // shouldn't happen!
}