Search in sources :

Example 41 with BiomeGenBase

use of net.minecraft.world.biome.BiomeGenBase in project BuildCraft by BuildCraft.

the class OilPopulateOld method generateSurfaceDeposit.

public void generateSurfaceDeposit(World world, Random rand, int x, int y, int z, int radius) {
    BiomeGenBase biome = world.getBiomeGenForCoords(new BlockPos(x, y, z));
    generateSurfaceDeposit(world, rand, biome, x, y, z, radius);
}
Also used : BlockPos(net.minecraft.util.math.BlockPos) BiomeGenBase(net.minecraft.world.biome.BiomeGenBase)

Example 42 with BiomeGenBase

use of net.minecraft.world.biome.BiomeGenBase in project RFToolsDimensions by McJty.

the class BiomeControllerMapping method findSuitableBiomes.

private static int findSuitableBiomes(BiomeGenBase[] biomeGenArray, BiomeGenBase biome, ControllerType.BiomeFilter filter) {
    double bestdist = 1000000000.0f;
    // Make sure we always have some matching biome.
    int bestidx = 0;
    for (BiomeGenBase base : biomeGenArray) {
        if (base != null && filter.match(base)) {
            // This 'base' could be a replacement. Check if it is close enough.
            if (biome.getBiomeClass() == base.getBiomeClass()) {
                // Same class, that's good enough for me.
                return base.biomeID;
            }
            double dist = filter.calculateBiomeDistance(biome, base);
            if (dist < bestdist) {
                bestdist = dist;
                bestidx = base.biomeID;
            }
        }
    }
    return bestidx;
}
Also used : BiomeGenBase(net.minecraft.world.biome.BiomeGenBase)

Example 43 with BiomeGenBase

use of net.minecraft.world.biome.BiomeGenBase in project RFToolsDimensions by McJty.

the class BiomeAbsorberTileEntity method placeDown.

public void placeDown() {
    if (biomeName == null) {
        BiomeGenBase biomeGenBase = worldObj.getBiomeGenForCoords(getPos());
        if (biomeGenBase == null) {
            biomeName = null;
            absorbing = 0;
        } else if (!biomeGenBase.biomeName.equals(biomeName)) {
            biomeName = biomeGenBase.biomeName;
            absorbing = DimletConstructionConfiguration.maxBiomeAbsorbtion;
        }
        markDirty();
    }
}
Also used : BiomeGenBase(net.minecraft.world.biome.BiomeGenBase)

Example 44 with BiomeGenBase

use of net.minecraft.world.biome.BiomeGenBase in project RFToolsDimensions by McJty.

the class BiomeAbsorberTileEntity method checkStateServer.

protected void checkStateServer() {
    if (absorbing > 0) {
        BiomeGenBase biomeGenBase = worldObj.getBiomeGenForCoords(getPos());
        if (biomeGenBase == null || !biomeGenBase.biomeName.equals(biomeName)) {
            return;
        }
        absorbing--;
        markDirtyClient();
    }
}
Also used : BiomeGenBase(net.minecraft.world.biome.BiomeGenBase)

Example 45 with BiomeGenBase

use of net.minecraft.world.biome.BiomeGenBase in project RFToolsDimensions by McJty.

the class DimensionInformation method setupFromNBT.

private void setupFromNBT(NBTTagCompound tagCompound) {
    terrainType = TerrainType.values()[tagCompound.getInteger("terrain")];
    featureTypes = toEnumSet(getIntArraySafe(tagCompound, "features"), FeatureType.values());
    structureTypes = toEnumSet(getIntArraySafe(tagCompound, "structures"), StructureType.values());
    effectTypes = toEnumSet(getIntArraySafe(tagCompound, "effects"), EffectType.values());
    biomes.clear();
    for (int a : getIntArraySafe(tagCompound, "biomes")) {
        BiomeGenBase biome = BiomeGenBase.getBiome(a);
        if (biome != null) {
            biomes.add(biome);
        } else {
            // Protect against deleted biomes (i.e. a mod with biomes gets removed and this dimension still uses it).
            // We will pick a replacement biome here.
            biomes.add(BiomeGenBase.plains);
        }
    }
    if (tagCompound.hasKey("controller")) {
        controllerType = ControllerType.values()[tagCompound.getInteger("controller")];
    } else {
        // Support for old type.
        if (biomes.isEmpty()) {
            controllerType = ControllerType.CONTROLLER_DEFAULT;
        } else {
            controllerType = ControllerType.CONTROLLER_SINGLE;
        }
    }
    digitString = tagCompound.getString("digits");
    forcedDimensionSeed = tagCompound.getLong("forcedSeed");
    baseSeed = tagCompound.getLong("baseSeed");
    worldVersion = tagCompound.getInteger("worldVersion");
    baseBlockForTerrain = getBlockMeta(tagCompound, "baseBlock");
    tendrilBlock = getBlockMeta(tagCompound, "tendrilBlock");
    canyonBlock = getBlockMeta(tagCompound, "canyonBlock");
    fluidForTerrain = (Block) Block.blockRegistry.getObjectById(tagCompound.getInteger("fluidBlock"));
    hugeLiquidSphereFluids = readFluidsFromNBT(tagCompound, "hugeLiquidSphereFluids");
    hugeLiquidSphereBlocks = readBlockArrayFromNBT(tagCompound, "hugeLiquidSphereBlocks");
    // Support for the old format with only one liquid block.
    Block oldLiquidSphereFluid = (Block) Block.blockRegistry.getObjectById(tagCompound.getInteger("liquidSphereFluid"));
    liquidSphereFluids = readFluidsFromNBT(tagCompound, "liquidSphereFluids");
    if (liquidSphereFluids.length == 0) {
        liquidSphereFluids = new Block[] { oldLiquidSphereFluid };
    }
    // Support for the old format with only one sphere block.
    IBlockState oldLiquidSphereBlock = getBlockMeta(tagCompound, "liquidSphereBlock");
    liquidSphereBlocks = readBlockArrayFromNBT(tagCompound, "liquidSphereBlocks");
    if (liquidSphereBlocks.length == 0) {
        liquidSphereBlocks = new IBlockState[] { oldLiquidSphereBlock };
    }
    pyramidBlocks = readBlockArrayFromNBT(tagCompound, "pyramidBlocks");
    if (pyramidBlocks.length == 0) {
        pyramidBlocks = new IBlockState[] { Blocks.stone.getDefaultState() };
    }
    // Support for the old format with only one sphere block.
    IBlockState oldSphereBlock = getBlockMeta(tagCompound, "sphereBlock");
    sphereBlocks = readBlockArrayFromNBT(tagCompound, "sphereBlocks");
    if (sphereBlocks.length == 0) {
        sphereBlocks = new IBlockState[] { oldSphereBlock };
    }
    hugeSphereBlocks = readBlockArrayFromNBT(tagCompound, "hugeSphereBlocks");
    extraOregen = readBlockArrayFromNBT(tagCompound, "extraOregen");
    fluidsForLakes = readFluidsFromNBT(tagCompound, "lakeFluids");
    peaceful = tagCompound.getBoolean("peaceful");
    noanimals = tagCompound.getBoolean("noanimals");
    shelter = tagCompound.getBoolean("shelter");
    respawnHere = tagCompound.getBoolean("respawnHere");
    if (tagCompound.hasKey("celestialAngle")) {
        celestialAngle = tagCompound.getFloat("celestialAngle");
    } else {
        celestialAngle = null;
    }
    if (tagCompound.hasKey("timeSpeed")) {
        timeSpeed = tagCompound.getFloat("timeSpeed");
    } else {
        timeSpeed = null;
    }
    probeCounter = tagCompound.getInteger("probes");
    actualRfCost = tagCompound.getInteger("actualCost");
    skyDescriptor = new SkyDescriptor.Builder().fromNBT(tagCompound).build();
    calculateCelestialBodyDescriptors();
    patreon1 = tagCompound.getLong("patreon1");
    weatherDescriptor = new WeatherDescriptor.Builder().fromNBT(tagCompound).build();
    extraMobs.clear();
    NBTTagList list = tagCompound.getTagList("mobs", Constants.NBT.TAG_COMPOUND);
    for (int i = 0; i < list.tagCount(); i++) {
        NBTTagCompound tc = list.getCompoundTagAt(i);
        String className = tc.getString("class");
        int chance = tc.getInteger("chance");
        int minGroup = tc.getInteger("minGroup");
        int maxGroup = tc.getInteger("maxGroup");
        int maxLoaded = tc.getInteger("maxLoaded");
        Class<? extends EntityLiving> c = null;
        try {
            c = (Class<? extends EntityLiving>) Class.forName(className);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
        MobDescriptor mob = new MobDescriptor(c, chance, minGroup, maxGroup, maxLoaded);
        extraMobs.add(mob);
    }
    String ds = tagCompound.getString("dimensionTypes");
    dimensionTypes = StringUtils.split(ds, ",");
    if (dimensionTypes == null) {
        dimensionTypes = new String[0];
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) BiomeGenBase(net.minecraft.world.biome.BiomeGenBase) Block(net.minecraft.block.Block)

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