Search in sources :

Example 36 with BiomeGenBase

use of net.minecraft.world.biome.BiomeGenBase in project NewHorizonsCoreMod by GTNewHorizons.

the class OilGeneratorFix method shouldSpawnOil.

// Check if given location is valid for spawning oil, and return the actual position in pPos
private boolean shouldSpawnOil(World pWorld, Random pRand, int pX, int pZ, Vec3 pPos) {
    // Limited to Whitelisted Dimensions
    if (!MainRegistry.CoreConfig.OilFixConfig.OilDimensionWhitelist.contains(pWorld.provider.dimensionId)) {
        if (YAMCore.isDebug())
            _mLog.info(String.format("Not generating OilDeposit; Dimension is not Whitelisted %d", pWorld.provider.dimensionId));
        return false;
    }
    BiomeGenBase biomegenbase = pWorld.getBiomeGenForCoords(pX + 8, pZ + 8);
    // Skip blacklisted DimensionIDs
    if (MainRegistry.CoreConfig.OilFixConfig.OilBiomeIDBlackList.contains(biomegenbase.biomeID)) {
        if (YAMCore.isDebug())
            _mLog.info(String.format("Not generating OilDeposit; BiomeID %d is Blacklisted", biomegenbase.biomeID));
        return false;
    }
    pRand.setSeed(pWorld.getSeed());
    long i1 = pRand.nextInt() / 2L * 2L + 1L;
    long j1 = pRand.nextInt() / 2L * 2L + 1L;
    pRand.setSeed(pX * i1 + pZ * j1 ^ pWorld.getSeed());
    double randMod = Math.min(0.2D, 0.0001D * MainRegistry.CoreConfig.OilFixConfig.OilSphereChance);
    if (biomegenbase.rootHeight >= 0.45F) {
        randMod /= 2.0D;
    }
    if (biomegenbase.rootHeight < -0.5F) {
        randMod *= 1.8D;
    }
    if (MainRegistry.CoreConfig.OilFixConfig.OilBoostBiomes.contains(biomegenbase.biomeID))
        randMod *= MainRegistry.CoreConfig.OilFixConfig.OilBiomeBoostFactor;
    boolean flag1 = pRand.nextDouble() <= randMod;
    boolean flag2 = pRand.nextDouble() <= randMod;
    if ((flag1) || (flag2)) {
        pPos.yCoord = (17 + pRand.nextInt(10) + pRand.nextInt(5));
        pPos.xCoord = (pX + pRand.nextInt(16));
        pPos.zCoord = (pZ + pRand.nextInt(16));
        return true;
    }
    return false;
}
Also used : BiomeGenBase(net.minecraft.world.biome.BiomeGenBase)

Example 37 with BiomeGenBase

use of net.minecraft.world.biome.BiomeGenBase in project Galacticraft by micdoodle8.

the class WorldChunkManagerVenus method areBiomesViable.

@Override
public boolean areBiomesViable(int x, int z, int range, List<BiomeGenBase> viables) {
    int i = x - range >> 2;
    int j = z - range >> 2;
    int k = x + range >> 2;
    int l = z + range >> 2;
    int diffX = (k - i) + 1;
    int diffZ = (l - j) + 1;
    int[] unzoomed = this.unzoomedBiomes.getInts(i, j, diffX, diffZ);
    for (int a = 0; a < diffX * diffZ; ++a) {
        BiomeGenBase biome = BiomeGenBase.getBiome(unzoomed[a]);
        if (!viables.contains(biome)) {
            return false;
        }
    }
    return true;
}
Also used : BiomeGenBase(net.minecraft.world.biome.BiomeGenBase)

Example 38 with BiomeGenBase

use of net.minecraft.world.biome.BiomeGenBase in project Galacticraft by micdoodle8.

the class MapUtil method getBiomeBaseColour.

private static int getBiomeBaseColour(int biomeId) {
    BiomeGenBase[] biomeList = BiomeGenBase.getBiomeGenArray();
    BiomeGenBase biomegenbase = null;
    if (biomeId >= 0 && biomeId <= biomeList.length) {
        biomegenbase = biomeList[biomeId];
    }
    return biomegenbase == null ? BiomeGenBase.ocean.color : biomegenbase.color;
}
Also used : BiomeGenBase(net.minecraft.world.biome.BiomeGenBase)

Example 39 with BiomeGenBase

use of net.minecraft.world.biome.BiomeGenBase in project Galacticraft by micdoodle8.

the class ChunkProviderMoon method populate.

@Override
public void populate(IChunkProvider chunkProvider, int x, int z) {
    BlockFalling.fallInstantly = true;
    int i = x * 16;
    int j = z * 16;
    BlockPos blockpos = new BlockPos(i, 0, j);
    BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(blockpos.add(16, 0, 16));
    this.rand.setSeed(this.worldObj.getSeed());
    long k = this.rand.nextLong() / 2L * 2L + 1L;
    long l = this.rand.nextLong() / 2L * 2L + 1L;
    this.rand.setSeed((long) x * k + (long) z * l ^ this.worldObj.getSeed());
    if (!ConfigManagerCore.disableMoonVillageGen) {
        this.villageGenerator.generateStructure(this.worldObj, this.rand, new ChunkCoordIntPair(x, z));
    }
    this.dungeonGeneratorMoon.generateStructure(this.worldObj, this.rand, new ChunkCoordIntPair(x, z));
    biomegenbase.decorate(this.worldObj, this.rand, new BlockPos(i, 0, j));
    BlockFalling.fallInstantly = false;
}
Also used : ChunkCoordIntPair(net.minecraft.world.ChunkCoordIntPair) BlockPos(net.minecraft.util.BlockPos) BiomeGenBase(net.minecraft.world.biome.BiomeGenBase)

Example 40 with BiomeGenBase

use of net.minecraft.world.biome.BiomeGenBase in project Galacticraft by micdoodle8.

the class MapGen method getBiomesForGeneration.

/**
 *      REPLICATES method in WorldChunkManager
 * Returns an array of biomes for the location input, used for generating the height map
 */
@Override
public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] biomes, int x, int z, int width, int height) {
    IntCache.resetIntCacheGC();
    int[] aint = this.genBiomes.getInts(x, z, width, height);
    int size = width * height;
    if (biomes == null || biomes.length < size) {
        biomes = new BiomeGenBase[size];
    }
    for (int i = 0; i < size; ++i) {
        int biomeId = aint[i];
        BiomeGenBase biomegenbase = null;
        if (biomeId >= 0 && biomeId <= biomeList.length) {
            biomegenbase = biomeList[biomeId];
        }
        // else
        // System.err.println("MapGen: Biome ID is out of bounds: " + biomeId + ", defaulting to 0 (Ocean)");
        biomes[i] = biomegenbase == null ? BiomeGenBase.ocean : biomegenbase;
    }
    return biomes;
}
Also used : BiomeGenBase(net.minecraft.world.biome.BiomeGenBase)

Aggregations

BiomeGenBase (net.minecraft.world.biome.BiomeGenBase)62 Block (net.minecraft.block.Block)9 BlockPos (net.minecraft.util.BlockPos)9 World (net.minecraft.world.World)6 Type (net.minecraftforge.common.BiomeDictionary.Type)5 ArrayList (java.util.ArrayList)4 EnumHumidity (forestry.api.core.EnumHumidity)3 IBlockState (net.minecraft.block.state.IBlockState)3 ChunkCoordIntPair (net.minecraft.world.ChunkCoordIntPair)3 Chunk (net.minecraft.world.chunk.Chunk)3 BiomeDictionary (net.minecraftforge.common.BiomeDictionary)3 HashMultimap (com.google.common.collect.HashMultimap)2 Multimap (com.google.common.collect.Multimap)2 IBeeGenome (forestry.api.apiculture.IBeeGenome)2 EnumTemperature (forestry.api.core.EnumTemperature)2 HashSet (java.util.HashSet)2 Random (java.util.Random)2 UUID (java.util.UUID)2 Entity (net.minecraft.entity.Entity)2 AttributeModifier (net.minecraft.entity.ai.attributes.AttributeModifier)2