Search in sources :

Example 26 with Biome

use of net.minecraft.world.biome.Biome in project MinecraftForge by MinecraftForge.

the class ForgeHooksClient method getSkyBlendColour.

public static int getSkyBlendColour(World world, BlockPos center) {
    if (center.getX() == skyX && center.getZ() == skyZ && skyInit) {
        return skyRGBMultiplier;
    }
    skyInit = true;
    GameSettings settings = Minecraft.getMinecraft().gameSettings;
    int[] ranges = ForgeModContainer.blendRanges;
    int distance = 0;
    if (settings.fancyGraphics && ranges.length > 0) {
        distance = ranges[MathHelper.clamp(settings.renderDistanceChunks, 0, ranges.length - 1)];
    }
    int r = 0;
    int g = 0;
    int b = 0;
    int divider = 0;
    for (int x = -distance; x <= distance; ++x) {
        for (int z = -distance; z <= distance; ++z) {
            BlockPos pos = center.add(x, 0, z);
            Biome biome = world.getBiome(pos);
            int colour = biome.getSkyColorByTemp(biome.getFloatTemperature(pos));
            r += (colour & 0xFF0000) >> 16;
            g += (colour & 0x00FF00) >> 8;
            b += colour & 0x0000FF;
            divider++;
        }
    }
    int multiplier = (r / divider & 255) << 16 | (g / divider & 255) << 8 | b / divider & 255;
    skyX = center.getX();
    skyZ = center.getZ();
    skyRGBMultiplier = multiplier;
    return skyRGBMultiplier;
}
Also used : Biome(net.minecraft.world.biome.Biome) BlockPos(net.minecraft.util.math.BlockPos) GameSettings(net.minecraft.client.settings.GameSettings)

Example 27 with Biome

use of net.minecraft.world.biome.Biome in project MinecraftForge by MinecraftForge.

the class ForgeModContainer method registerAllBiomesAndGenerateEvents.

private static void registerAllBiomesAndGenerateEvents() {
    for (Biome biome : ForgeRegistries.BIOMES.getValues()) {
        if (biome.theBiomeDecorator instanceof DeferredBiomeDecorator) {
            DeferredBiomeDecorator decorator = (DeferredBiomeDecorator) biome.theBiomeDecorator;
            decorator.fireCreateEventAndReplace(biome);
        }
        BiomeDictionary.ensureHasTypes(biome);
    }
}
Also used : Biome(net.minecraft.world.biome.Biome) DeferredBiomeDecorator(net.minecraftforge.event.terraingen.DeferredBiomeDecorator)

Example 28 with Biome

use of net.minecraft.world.biome.Biome in project MinecraftForge by MinecraftForge.

the class BiomeSpawnableListTest method testAddAndRemoveSpawn.

@Test
public void testAddAndRemoveSpawn() throws Exception {
    final Class<EntityHorse> entityClass = EntityHorse.class;
    final int weightedProb = 1;
    final int minGroupCount = 1;
    final int maxGroupCount = 20;
    final Biome biome = Biomes.PLAINS;
    // Test 1: We can add a spawn for the non-vanilla EnumCreatureType
    EntityRegistry.addSpawn(entityClass, weightedProb, minGroupCount, maxGroupCount, creatureTypeHorse, biome);
    final boolean containsEntryAfterAdd = spawnableListContainsEntry(entityClass, weightedProb, minGroupCount, maxGroupCount, creatureTypeHorse, biome);
    assertTrue("The SpawnListEntry wasn't added", containsEntryAfterAdd);
    // Test 2: We can remove a spawn for the non-vanilla EnumCreatureType
    EntityRegistry.removeSpawn(entityClass, creatureTypeHorse, biome);
    final boolean containsEntryAfterRemove = spawnableListContainsEntry(entityClass, weightedProb, minGroupCount, maxGroupCount, creatureTypeHorse, biome);
    assertFalse("The SpawnListEntry wasn't removed", containsEntryAfterRemove);
}
Also used : EntityHorse(net.minecraft.entity.passive.EntityHorse) Biome(net.minecraft.world.biome.Biome) Test(org.junit.Test)

Example 29 with Biome

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

the class BiomeAbsorberTileEntity method placeDown.

public void placeDown() {
    if (biomeId == null) {
        Biome Biome = getWorld().getBiomeForCoordsBody(getPos());
        if (Biome == null) {
            biomeId = null;
            absorbing = 0;
        } else if (!Biome.getRegistryName().toString().equals(biomeId)) {
            biomeId = Biome.getRegistryName().toString();
            absorbing = DimletConstructionConfiguration.maxBiomeAbsorbtion;
        }
        markDirty();
    }
}
Also used : Biome(net.minecraft.world.biome.Biome)

Example 30 with Biome

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

the class BiomeAbsorberTileEntity method checkStateServer.

protected void checkStateServer() {
    if (absorbing > 0) {
        Biome Biome = getWorld().getBiomeForCoordsBody(getPos());
        if (Biome == null || !Biome.getRegistryName().toString().equals(biomeId)) {
            return;
        }
        absorbing--;
        markDirtyClient();
    }
}
Also used : Biome(net.minecraft.world.biome.Biome)

Aggregations

Biome (net.minecraft.world.biome.Biome)66 BlockPos (net.minecraft.util.math.BlockPos)17 IBlockState (net.minecraft.block.state.IBlockState)8 World (net.minecraft.world.World)5 WorldServer (net.minecraft.world.WorldServer)5 Random (java.util.Random)4 Block (net.minecraft.block.Block)4 ChunkPos (net.minecraft.util.math.ChunkPos)4 ResourceLocation (net.minecraft.util.ResourceLocation)3 List (java.util.List)2 ChunkProviderSettings (net.minecraft.world.gen.ChunkProviderSettings)2 ChunkGeneratorEvent (net.minecraftforge.event.terraingen.ChunkGeneratorEvent)2 NetherExBiomeType (nex.world.biome.NetherExBiomeType)2 Pair (org.apache.commons.lang3.tuple.Pair)2 IRealisticBiome (rtg.api.world.biome.IRealisticBiome)2 RealisticBiomeBase (rtg.world.biome.realistic.RealisticBiomeBase)2 Gson (com.google.gson.Gson)1 BlockSurfacePos (ivorius.ivtoolkit.blocks.BlockSurfacePos)1 IvVecMathHelper (ivorius.ivtoolkit.math.IvVecMathHelper)1 RCConfig (ivorius.reccomplex.RCConfig)1