Search in sources :

Example 61 with BiomeGenBase

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

the class GuiHabitatLocator method drawGuiContainerBackgroundLayer.

@Override
protected void drawGuiContainerBackgroundLayer(float var1, int mouseX, int mouseY) {
    super.drawGuiContainerBackgroundLayer(var1, mouseX, mouseY);
    String str = StatCollector.translateToLocal("item.for.habitatLocator.name").toUpperCase();
    fontRendererObj.drawString(str, startX + 8 + getCenteredOffset(str, 138), startY + 16, fontColor.get("gui.screen"));
    // Set active according to valid biomes.
    Set<BiomeDictionary.Type> activeBiomeTypes = new HashSet<BiomeDictionary.Type>();
    for (HabitatSlot habitatSlot : habitatSlots) {
        habitatSlot.isActive = false;
    }
    for (BiomeGenBase biome : inventory.biomesToSearch) {
        Collections.addAll(activeBiomeTypes, BiomeDictionary.getTypesForBiome(biome));
    }
    for (BiomeDictionary.Type biomeType : activeBiomeTypes) {
        HabitatSlot habitatSlot = biomeToHabitat.get(biomeType);
        if (habitatSlot != null) {
            habitatSlot.isActive = true;
        }
    }
    for (HabitatSlot slot : habitatSlots) {
        slot.draw(startX, startY);
    }
    // Reset afterwards.
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
Also used : BiomeDictionary(net.minecraftforge.common.BiomeDictionary) BiomeGenBase(net.minecraft.world.biome.BiomeGenBase) HashSet(java.util.HashSet)

Example 62 with BiomeGenBase

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

the class MachineRaintank method validate.

@Override
public void validate() {
    // Raintanks in desert and snow biomes are useless
    if (worldObj != null) {
        BiomeGenBase biome = Utils.getBiomeAt(worldObj, xCoord, zCoord);
        if (!BiomeHelper.canRainOrSnow(biome)) {
            setErrorState(EnumErrorCode.INVALIDBIOME);
            isValidBiome = false;
        }
    }
    super.validate();
}
Also used : BiomeGenBase(net.minecraft.world.biome.BiomeGenBase)

Example 63 with BiomeGenBase

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

the class HiveDecorator method decorateHivesDebug.

private void decorateHivesDebug(World world, int chunkX, int chunkZ, List<Hive> hives) {
    int worldX = chunkX * 16;
    int worldZ = chunkZ * 16;
    BiomeGenBase biome = world.getBiomeGenForCoords(worldX, worldZ);
    EnumHumidity humidity = EnumHumidity.getFromValue(biome.rainfall);
    for (int x = 0; x < 16; x++) {
        for (int z = 0; z < 16; z++) {
            Collections.shuffle(hives, world.rand);
            for (Hive hive : hives) {
                if (!hive.isGoodBiome(biome) || !hive.isGoodHumidity(humidity)) {
                    continue;
                }
                tryGenHive(world, worldX + x, worldZ + z, hive);
            }
        }
    }
}
Also used : EnumHumidity(forestry.api.core.EnumHumidity) BiomeGenBase(net.minecraft.world.biome.BiomeGenBase)

Aggregations

BiomeGenBase (net.minecraft.world.biome.BiomeGenBase)63 BlockPos (net.minecraft.util.BlockPos)10 Block (net.minecraft.block.Block)8 World (net.minecraft.world.World)5 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 BiomeDictionary (net.minecraftforge.common.BiomeDictionary)3 IBeeGenome (forestry.api.apiculture.IBeeGenome)2 EnumTemperature (forestry.api.core.EnumTemperature)2 File (java.io.File)2 HashSet (java.util.HashSet)2 Random (java.util.Random)2 Material (net.minecraft.block.material.Material)2 Entity (net.minecraft.entity.Entity)2 ChunkCoordinates (net.minecraft.util.ChunkCoordinates)2 EventHandler (net.minecraftforge.fml.common.Mod.EventHandler)2 Color (org.blockartistry.mod.DynSurround.util.Color)2