Java Code Examples for net.minecraft.world.biome.BiomeGenBase

The following are top voted examples for showing how to use net.minecraft.world.biome.BiomeGenBase. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: DecompiledMinecraft   File: WorldProvider.java   Source Code and License 6 votes vote down vote up
/**
 * creates a new world chunk manager for WorldProvider
 */
protected void registerWorldChunkManager()
{
    WorldType worldtype = this.worldObj.getWorldInfo().getTerrainType();

    if (worldtype == WorldType.FLAT)
    {
        FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.createFlatGeneratorFromString(this.worldObj.getWorldInfo().getGeneratorOptions());
        this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), BiomeGenBase.field_180279_ad), 0.5F);
    }
    else if (worldtype == WorldType.DEBUG_WORLD)
    {
        this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.plains, 0.0F);
    }
    else
    {
        this.worldChunkMgr = new WorldChunkManager(this.worldObj);
    }
}
 
Example 2
Project: TRAPPIST-1   File: TPBiomeDecorator.java   Source Code and License 6 votes vote down vote up
@Override
public void decorateChunk(World world, Random rand, BiomeGenBase biome, int x, int z)
{
	if (this.currentWorld != null)
	{
		throw new RuntimeException("Already decorating!!");
	}
	else
	{
		this.currentWorld = world;
		this.randomGenerator = rand;
		this.chunk_X = x;
		this.chunk_Z = z;
		this.genDecorations(biome);
		this.currentWorld = null;
		this.randomGenerator = null;
	}
}
 
Example 3
Project: BaseClient   File: GuiFlatPresets.java   Source Code and License 6 votes vote down vote up
private static void func_175354_a(String p_175354_0_, Item p_175354_1_, int p_175354_2_, BiomeGenBase p_175354_3_, List<String> p_175354_4_, FlatLayerInfo... p_175354_5_)
{
    FlatGeneratorInfo flatgeneratorinfo = new FlatGeneratorInfo();

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

    flatgeneratorinfo.setBiome(p_175354_3_.biomeID);
    flatgeneratorinfo.func_82645_d();

    if (p_175354_4_ != null)
    {
        for (String s : p_175354_4_)
        {
            flatgeneratorinfo.getWorldFeatures().put(s, Maps.<String, String>newHashMap());
        }
    }

    FLAT_WORLD_PRESETS.add(new GuiFlatPresets.LayerItem(p_175354_1_, p_175354_2_, p_175354_0_, flatgeneratorinfo.toString()));
}
 
Example 4
Project: BaseClient   File: GenLayerBiome.java   Source Code and License 6 votes vote down vote up
public GenLayerBiome(long p_i45560_1_, GenLayer p_i45560_3_, WorldType p_i45560_4_, String p_i45560_5_)
{
    super(p_i45560_1_);
    this.parent = p_i45560_3_;

    if (p_i45560_4_ == WorldType.DEFAULT_1_1)
    {
        this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.swampland, BiomeGenBase.plains, BiomeGenBase.taiga};
        this.field_175973_g = null;
    }
    else if (p_i45560_4_ == WorldType.CUSTOMIZED)
    {
        this.field_175973_g = ChunkProviderSettings.Factory.jsonToFactory(p_i45560_5_).func_177864_b();
    }
    else
    {
        this.field_175973_g = null;
    }
}
 
Example 5
Project: DecompiledMinecraft   File: ChunkProviderHell.java   Source Code and License 6 votes vote down vote up
public List<BiomeGenBase.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos)
{
    if (creatureType == EnumCreatureType.MONSTER)
    {
        if (this.genNetherBridge.func_175795_b(pos))
        {
            return this.genNetherBridge.getSpawnList();
        }

        if (this.genNetherBridge.func_175796_a(this.worldObj, pos) && this.worldObj.getBlockState(pos.down()).getBlock() == Blocks.nether_brick)
        {
            return this.genNetherBridge.getSpawnList();
        }
    }

    BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(pos);
    return biomegenbase.getSpawnableList(creatureType);
}
 
Example 6
Project: BaseClient   File: MapGenScatteredFeature.java   Source Code and License 6 votes vote down vote up
public Start(World worldIn, Random p_i2060_2_, int p_i2060_3_, int p_i2060_4_)
{
    super(p_i2060_3_, p_i2060_4_);
    BiomeGenBase biomegenbase = worldIn.getBiomeGenForCoords(new BlockPos(p_i2060_3_ * 16 + 8, 0, p_i2060_4_ * 16 + 8));

    if (biomegenbase != BiomeGenBase.jungle && biomegenbase != BiomeGenBase.jungleHills)
    {
        if (biomegenbase == BiomeGenBase.swampland)
        {
            ComponentScatteredFeaturePieces.SwampHut componentscatteredfeaturepieces$swamphut = new ComponentScatteredFeaturePieces.SwampHut(p_i2060_2_, p_i2060_3_ * 16, p_i2060_4_ * 16);
            this.components.add(componentscatteredfeaturepieces$swamphut);
        }
        else if (biomegenbase == BiomeGenBase.desert || biomegenbase == BiomeGenBase.desertHills)
        {
            ComponentScatteredFeaturePieces.DesertPyramid componentscatteredfeaturepieces$desertpyramid = new ComponentScatteredFeaturePieces.DesertPyramid(p_i2060_2_, p_i2060_3_ * 16, p_i2060_4_ * 16);
            this.components.add(componentscatteredfeaturepieces$desertpyramid);
        }
    }
    else
    {
        ComponentScatteredFeaturePieces.JunglePyramid componentscatteredfeaturepieces$junglepyramid = new ComponentScatteredFeaturePieces.JunglePyramid(p_i2060_2_, p_i2060_3_ * 16, p_i2060_4_ * 16);
        this.components.add(componentscatteredfeaturepieces$junglepyramid);
    }

    this.updateBoundingBox();
}
 
Example 7
Project: BaseClient   File: Matches.java   Source Code and License 6 votes vote down vote up
public static boolean biome(BiomeGenBase p_biome_0_, BiomeGenBase[] p_biome_1_)
{
    if (p_biome_1_ == null)
    {
        return true;
    }
    else
    {
        for (int i = 0; i < p_biome_1_.length; ++i)
        {
            if (p_biome_1_[i] == p_biome_0_)
            {
                return true;
            }
        }

        return false;
    }
}
 
Example 8
Project: BaseClient   File: GuiFlatPresets.java   Source Code and License 6 votes vote down vote up
private static void func_175354_a(String p_175354_0_, Item p_175354_1_, int p_175354_2_, BiomeGenBase p_175354_3_, List<String> p_175354_4_, FlatLayerInfo... p_175354_5_)
{
    FlatGeneratorInfo flatgeneratorinfo = new FlatGeneratorInfo();

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

    flatgeneratorinfo.setBiome(p_175354_3_.biomeID);
    flatgeneratorinfo.func_82645_d();

    if (p_175354_4_ != null)
    {
        for (String s : p_175354_4_)
        {
            flatgeneratorinfo.getWorldFeatures().put(s, Maps.<String, String>newHashMap());
        }
    }

    FLAT_WORLD_PRESETS.add(new GuiFlatPresets.LayerItem(p_175354_1_, p_175354_2_, p_175354_0_, flatgeneratorinfo.toString()));
}
 
Example 9
Project: DecompiledMinecraft   File: GenLayerBiome.java   Source Code and License 6 votes vote down vote up
public GenLayerBiome(long p_i45560_1_, GenLayer p_i45560_3_, WorldType p_i45560_4_, String p_i45560_5_)
{
    super(p_i45560_1_);
    this.parent = p_i45560_3_;

    if (p_i45560_4_ == WorldType.DEFAULT_1_1)
    {
        this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.swampland, BiomeGenBase.plains, BiomeGenBase.taiga};
        this.field_175973_g = null;
    }
    else if (p_i45560_4_ == WorldType.CUSTOMIZED)
    {
        this.field_175973_g = ChunkProviderSettings.Factory.jsonToFactory(p_i45560_5_).func_177864_b();
    }
    else
    {
        this.field_175973_g = null;
    }
}
 
Example 10
Project: BaseClient   File: ChunkProviderHell.java   Source Code and License 6 votes vote down vote up
public List<BiomeGenBase.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos)
{
    if (creatureType == EnumCreatureType.MONSTER)
    {
        if (this.genNetherBridge.func_175795_b(pos))
        {
            return this.genNetherBridge.getSpawnList();
        }

        if (this.genNetherBridge.func_175796_a(this.worldObj, pos) && this.worldObj.getBlockState(pos.down()).getBlock() == Blocks.nether_brick)
        {
            return this.genNetherBridge.getSpawnList();
        }
    }

    BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(pos);
    return biomegenbase.getSpawnableList(creatureType);
}
 
Example 11
Project: BaseClient   File: World.java   Source Code and License 6 votes vote down vote up
public boolean canLightningStrike(BlockPos strikePosition)
{
    if (!this.isRaining())
    {
        return false;
    }
    else if (!this.canSeeSky(strikePosition))
    {
        return false;
    }
    else if (this.getPrecipitationHeight(strikePosition).getY() > strikePosition.getY())
    {
        return false;
    }
    else
    {
        BiomeGenBase biomegenbase = this.getBiomeGenForCoords(strikePosition);
        return biomegenbase.getEnableSnow() ? false : (this.canSnowAt(strikePosition, false) ? false : biomegenbase.canSpawnLightningBolt());
    }
}
 
Example 12
Project: DecompiledMinecraft   File: WorldProvider.java   Source Code and License 6 votes vote down vote up
/**
 * creates a new world chunk manager for WorldProvider
 */
protected void registerWorldChunkManager()
{
    WorldType worldtype = this.worldObj.getWorldInfo().getTerrainType();

    if (worldtype == WorldType.FLAT)
    {
        FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.createFlatGeneratorFromString(this.worldObj.getWorldInfo().getGeneratorOptions());
        this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), BiomeGenBase.field_180279_ad), 0.5F);
    }
    else if (worldtype == WorldType.DEBUG_WORLD)
    {
        this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.plains, 0.0F);
    }
    else
    {
        this.worldChunkMgr = new WorldChunkManager(this.worldObj);
    }
}
 
Example 13
Project: BaseClient   File: ChunkProviderHell.java   Source Code and License 6 votes vote down vote up
/**
 * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
 * specified chunk from the map seed and chunk seed
 */
public Chunk provideChunk(int x, int z)
{
    this.hellRNG.setSeed((long)x * 341873128712L + (long)z * 132897987541L);
    ChunkPrimer chunkprimer = new ChunkPrimer();
    this.func_180515_a(x, z, chunkprimer);
    this.func_180516_b(x, z, chunkprimer);
    this.netherCaveGenerator.generate(this, this.worldObj, x, z, chunkprimer);

    if (this.field_177466_i)
    {
        this.genNetherBridge.generate(this, this.worldObj, x, z, chunkprimer);
    }

    Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z);
    BiomeGenBase[] abiomegenbase = this.worldObj.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[])null, x * 16, z * 16, 16, 16);
    byte[] abyte = chunk.getBiomeArray();

    for (int i = 0; i < abyte.length; ++i)
    {
        abyte[i] = (byte)abiomegenbase[i].biomeID;
    }

    chunk.resetRelightChecks();
    return chunk;
}
 
Example 14
Project: BaseClient   File: World.java   Source Code and License 6 votes vote down vote up
public boolean canLightningStrike(BlockPos strikePosition)
{
    if (!this.isRaining())
    {
        return false;
    }
    else if (!this.canSeeSky(strikePosition))
    {
        return false;
    }
    else if (this.getPrecipitationHeight(strikePosition).getY() > strikePosition.getY())
    {
        return false;
    }
    else
    {
        BiomeGenBase biomegenbase = this.getBiomeGenForCoords(strikePosition);
        return biomegenbase.getEnableSnow() ? false : (this.canSnowAt(strikePosition, false) ? false : biomegenbase.canSpawnLightningBolt());
    }
}
 
Example 15
Project: BaseClient   File: Chunk.java   Source Code and License 6 votes vote down vote up
public BiomeGenBase getBiome(BlockPos pos, WorldChunkManager chunkManager)
{
    int i = pos.getX() & 15;
    int j = pos.getZ() & 15;
    int k = this.blockBiomeArray[j << 4 | i] & 255;

    if (k == 255)
    {
        BiomeGenBase biomegenbase = chunkManager.getBiomeGenerator(pos, BiomeGenBase.plains);
        k = biomegenbase.biomeID;
        this.blockBiomeArray[j << 4 | i] = (byte)(k & 255);
    }

    BiomeGenBase biomegenbase1 = BiomeGenBase.getBiome(k);
    return biomegenbase1 == null ? BiomeGenBase.plains : biomegenbase1;
}
 
Example 16
Project: DecompiledMinecraft   File: ChunkProviderHell.java   Source Code and License 6 votes vote down vote up
/**
 * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
 * specified chunk from the map seed and chunk seed
 */
public Chunk provideChunk(int x, int z)
{
    this.hellRNG.setSeed((long)x * 341873128712L + (long)z * 132897987541L);
    ChunkPrimer chunkprimer = new ChunkPrimer();
    this.func_180515_a(x, z, chunkprimer);
    this.func_180516_b(x, z, chunkprimer);
    this.netherCaveGenerator.generate(this, this.worldObj, x, z, chunkprimer);

    if (this.field_177466_i)
    {
        this.genNetherBridge.generate(this, this.worldObj, x, z, chunkprimer);
    }

    Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z);
    BiomeGenBase[] abiomegenbase = this.worldObj.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[])null, x * 16, z * 16, 16, 16);
    byte[] abyte = chunk.getBiomeArray();

    for (int i = 0; i < abyte.length; ++i)
    {
        abyte[i] = (byte)abiomegenbase[i].biomeID;
    }

    chunk.resetRelightChecks();
    return chunk;
}
 
Example 17
Project: DecompiledMinecraft   File: World.java   Source Code and License 6 votes vote down vote up
public boolean canLightningStrike(BlockPos strikePosition)
{
    if (!this.isRaining())
    {
        return false;
    }
    else if (!this.canSeeSky(strikePosition))
    {
        return false;
    }
    else if (this.getPrecipitationHeight(strikePosition).getY() > strikePosition.getY())
    {
        return false;
    }
    else
    {
        BiomeGenBase biomegenbase = this.getBiomeGenForCoords(strikePosition);
        return biomegenbase.getEnableSnow() ? false : (this.canSnowAt(strikePosition, false) ? false : biomegenbase.canSpawnLightningBolt());
    }
}
 
Example 18
Project: DecompiledMinecraft   File: ChunkProviderGenerate.java   Source Code and License 6 votes vote down vote up
public List<BiomeGenBase.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos)
{
    BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(pos);

    if (this.mapFeaturesEnabled)
    {
        if (creatureType == EnumCreatureType.MONSTER && this.scatteredFeatureGenerator.func_175798_a(pos))
        {
            return this.scatteredFeatureGenerator.getScatteredFeatureSpawnList();
        }

        if (creatureType == EnumCreatureType.MONSTER && this.settings.useMonuments && this.oceanMonumentGenerator.func_175796_a(this.worldObj, pos))
        {
            return this.oceanMonumentGenerator.func_175799_b();
        }
    }

    return biomegenbase.getSpawnableList(creatureType);
}
 
Example 19
Project: BaseClient   File: RandomMobsRule.java   Source Code and License 6 votes vote down vote up
public boolean matches(EntityLiving p_matches_1_)
{
    if (this.biomes != null)
    {
        BiomeGenBase biomegenbase = p_matches_1_.spawnBiome;
        boolean flag = false;

        for (int i = 0; i < this.biomes.length; ++i)
        {
            BiomeGenBase biomegenbase1 = this.biomes[i];

            if (biomegenbase1 == biomegenbase)
            {
                flag = true;
                break;
            }
        }

        if (!flag)
        {
            return false;
        }
    }

    return this.heights != null && p_matches_1_.spawnPosition != null ? this.heights.isInRange(p_matches_1_.spawnPosition.getY()) : true;
}
 
Example 20
Project: BaseClient   File: ChunkProviderGenerate.java   Source Code and License 6 votes vote down vote up
public List<BiomeGenBase.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos)
{
    BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(pos);

    if (this.mapFeaturesEnabled)
    {
        if (creatureType == EnumCreatureType.MONSTER && this.scatteredFeatureGenerator.func_175798_a(pos))
        {
            return this.scatteredFeatureGenerator.getScatteredFeatureSpawnList();
        }

        if (creatureType == EnumCreatureType.MONSTER && this.settings.useMonuments && this.oceanMonumentGenerator.func_175796_a(this.worldObj, pos))
        {
            return this.oceanMonumentGenerator.func_175799_b();
        }
    }

    return biomegenbase.getSpawnableList(creatureType);
}
 
Example 21
Project: BaseClient   File: WorldProvider.java   Source Code and License 6 votes vote down vote up
/**
 * creates a new world chunk manager for WorldProvider
 */
protected void registerWorldChunkManager()
{
    WorldType worldtype = this.worldObj.getWorldInfo().getTerrainType();

    if (worldtype == WorldType.FLAT)
    {
        FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.createFlatGeneratorFromString(this.worldObj.getWorldInfo().getGeneratorOptions());
        this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), BiomeGenBase.field_180279_ad), 0.5F);
    }
    else if (worldtype == WorldType.DEBUG_WORLD)
    {
        this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.plains, 0.0F);
    }
    else
    {
        this.worldChunkMgr = new WorldChunkManager(this.worldObj);
    }
}
 
Example 22
Project: Uranium   File: CraftBlock.java   Source Code and License 5 votes vote down vote up
public static Biome biomeBaseToBiome(BiomeGenBase base) {
    if (base == null) {
        return null;
    }

    return BIOME_MAPPING[base.biomeID];
}
 
Example 23
Project: BaseClient   File: StructureOceanMonument.java   Source Code and License 5 votes vote down vote up
protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ)
{
    int i = chunkX;
    int j = chunkZ;

    if (chunkX < 0)
    {
        chunkX -= this.field_175800_f - 1;
    }

    if (chunkZ < 0)
    {
        chunkZ -= this.field_175800_f - 1;
    }

    int k = chunkX / this.field_175800_f;
    int l = chunkZ / this.field_175800_f;
    Random random = this.worldObj.setRandomSeed(k, l, 10387313);
    k = k * this.field_175800_f;
    l = l * this.field_175800_f;
    k = k + (random.nextInt(this.field_175800_f - this.field_175801_g) + random.nextInt(this.field_175800_f - this.field_175801_g)) / 2;
    l = l + (random.nextInt(this.field_175800_f - this.field_175801_g) + random.nextInt(this.field_175800_f - this.field_175801_g)) / 2;

    if (i == k && j == l)
    {
        if (this.worldObj.getWorldChunkManager().getBiomeGenerator(new BlockPos(i * 16 + 8, 64, j * 16 + 8), (BiomeGenBase)null) != BiomeGenBase.deepOcean)
        {
            return false;
        }

        boolean flag = this.worldObj.getWorldChunkManager().areBiomesViable(i * 16 + 8, j * 16 + 8, 29, field_175802_d);

        if (flag)
        {
            return true;
        }
    }

    return false;
}
 
Example 24
Project: BaseClient   File: CustomColormap.java   Source Code and License 5 votes vote down vote up
private int getColorVanilla(BiomeGenBase p_getColorVanilla_1_, BlockPos p_getColorVanilla_2_)
{
    double d0 = (double)MathHelper.clamp_float(p_getColorVanilla_1_.getFloatTemperature(p_getColorVanilla_2_), 0.0F, 1.0F);
    double d1 = (double)MathHelper.clamp_float(p_getColorVanilla_1_.getFloatRainfall(), 0.0F, 1.0F);
    d1 = d1 * d0;
    int i = (int)((1.0D - d0) * (double)(this.width - 1));
    int j = (int)((1.0D - d1) * (double)(this.height - 1));
    return this.getColor(i, j);
}
 
Example 25
Project: DecompiledMinecraft   File: MapGenStronghold.java   Source Code and License 5 votes vote down vote up
public MapGenStronghold()
{
    this.structureCoords = new ChunkCoordIntPair[3];
    this.field_82671_h = 32.0D;
    this.field_82672_i = 3;
    this.field_151546_e = Lists.<BiomeGenBase>newArrayList();

    for (BiomeGenBase biomegenbase : BiomeGenBase.getBiomeGenArray())
    {
        if (biomegenbase != null && biomegenbase.minHeight > 0.0F)
        {
            this.field_151546_e.add(biomegenbase);
        }
    }
}
 
Example 26
Project: DecompiledMinecraft   File: StructureOceanMonument.java   Source Code and License 5 votes vote down vote up
protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ)
{
    int i = chunkX;
    int j = chunkZ;

    if (chunkX < 0)
    {
        chunkX -= this.field_175800_f - 1;
    }

    if (chunkZ < 0)
    {
        chunkZ -= this.field_175800_f - 1;
    }

    int k = chunkX / this.field_175800_f;
    int l = chunkZ / this.field_175800_f;
    Random random = this.worldObj.setRandomSeed(k, l, 10387313);
    k = k * this.field_175800_f;
    l = l * this.field_175800_f;
    k = k + (random.nextInt(this.field_175800_f - this.field_175801_g) + random.nextInt(this.field_175800_f - this.field_175801_g)) / 2;
    l = l + (random.nextInt(this.field_175800_f - this.field_175801_g) + random.nextInt(this.field_175800_f - this.field_175801_g)) / 2;

    if (i == k && j == l)
    {
        if (this.worldObj.getWorldChunkManager().getBiomeGenerator(new BlockPos(i * 16 + 8, 64, j * 16 + 8), (BiomeGenBase)null) != BiomeGenBase.deepOcean)
        {
            return false;
        }

        boolean flag = this.worldObj.getWorldChunkManager().areBiomesViable(i * 16 + 8, j * 16 + 8, 29, field_175802_d);

        if (flag)
        {
            return true;
        }
    }

    return false;
}
 
Example 27
Project: BaseClient   File: BlockBed.java   Source Code and License 5 votes vote down vote up
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (worldIn.isRemote)
    {
        return true;
    }
    else
    {
        if (state.getValue(PART) != BlockBed.EnumPartType.HEAD)
        {
            pos = pos.offset((EnumFacing)state.getValue(FACING));
            state = worldIn.getBlockState(pos);

            if (state.getBlock() != this)
            {
                return true;
            }
        }

        if (worldIn.provider.canRespawnHere() && worldIn.getBiomeGenForCoords(pos) != BiomeGenBase.hell)
        {
            if (((Boolean)state.getValue(OCCUPIED)).booleanValue())
            {
                EntityPlayer entityplayer = this.getPlayerInBed(worldIn, pos);

                if (entityplayer != null)
                {
                    playerIn.addChatComponentMessage(new ChatComponentTranslation("tile.bed.occupied", new Object[0]));
                    return true;
                }

                state = state.withProperty(OCCUPIED, Boolean.valueOf(false));
                worldIn.setBlockState(pos, state, 4);
            }

            EntityPlayer.EnumStatus entityplayer$enumstatus = playerIn.trySleep(pos);

            if (entityplayer$enumstatus == EntityPlayer.EnumStatus.OK)
            {
                state = state.withProperty(OCCUPIED, Boolean.valueOf(true));
                worldIn.setBlockState(pos, state, 4);
                return true;
            }
            else
            {
                if (entityplayer$enumstatus == EntityPlayer.EnumStatus.NOT_POSSIBLE_NOW)
                {
                    playerIn.addChatComponentMessage(new ChatComponentTranslation("tile.bed.noSleep", new Object[0]));
                }
                else if (entityplayer$enumstatus == EntityPlayer.EnumStatus.NOT_SAFE)
                {
                    playerIn.addChatComponentMessage(new ChatComponentTranslation("tile.bed.notSafe", new Object[0]));
                }

                return true;
            }
        }
        else
        {
            worldIn.setBlockToAir(pos);
            BlockPos blockpos = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite());

            if (worldIn.getBlockState(blockpos).getBlock() == this)
            {
                worldIn.setBlockToAir(blockpos);
            }

            worldIn.newExplosion((Entity)null, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 5.0F, true, true);
            return true;
        }
    }
}
 
Example 28
Project: BaseClient   File: MapGenNetherBridge.java   Source Code and License 5 votes vote down vote up
public MapGenNetherBridge()
{
    this.spawnList.add(new BiomeGenBase.SpawnListEntry(EntityBlaze.class, 10, 2, 3));
    this.spawnList.add(new BiomeGenBase.SpawnListEntry(EntityPigZombie.class, 5, 4, 4));
    this.spawnList.add(new BiomeGenBase.SpawnListEntry(EntitySkeleton.class, 10, 4, 4));
    this.spawnList.add(new BiomeGenBase.SpawnListEntry(EntityMagmaCube.class, 3, 4, 4));
}
 
Example 29
Project: DecompiledMinecraft   File: StructureVillagePieces.java   Source Code and License 5 votes vote down vote up
public Start(WorldChunkManager 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_;
    BiomeGenBase biomegenbase = chunkManagerIn.getBiomeGenerator(new BlockPos(p_i2104_4_, 0, p_i2104_5_), BiomeGenBase.field_180279_ad);
    this.inDesert = biomegenbase == BiomeGenBase.desert || biomegenbase == BiomeGenBase.desertHills;
    this.func_175846_a(this.inDesert);
}
 
Example 30
Project: BaseClient   File: RandomMobsProperties.java   Source Code and License 5 votes vote down vote up
private RandomMobsRule[] parseRules(Properties p_parseRules_1_, ResourceLocation p_parseRules_2_, ConnectedParser p_parseRules_3_)
{
    List list = new ArrayList();
    int i = p_parseRules_1_.size();

    for (int j = 0; j < i; ++j)
    {
        int k = j + 1;
        String s = p_parseRules_1_.getProperty("skins." + k);

        if (s != null)
        {
            int[] aint = p_parseRules_3_.parseIntList(s);
            int[] aint1 = p_parseRules_3_.parseIntList(p_parseRules_1_.getProperty("weights." + k));
            BiomeGenBase[] abiomegenbase = p_parseRules_3_.parseBiomes(p_parseRules_1_.getProperty("biomes." + k));
            RangeListInt rangelistint = p_parseRules_3_.parseRangeListInt(p_parseRules_1_.getProperty("heights." + k));

            if (rangelistint == null)
            {
                rangelistint = this.parseMinMaxHeight(p_parseRules_1_, k);
            }

            RandomMobsRule randommobsrule = new RandomMobsRule(p_parseRules_2_, aint, aint1, abiomegenbase, rangelistint);
            list.add(randommobsrule);
        }
    }

    RandomMobsRule[] arandommobsrule = (RandomMobsRule[])((RandomMobsRule[])list.toArray(new RandomMobsRule[list.size()]));
    return arandommobsrule;
}
 
Example 31
Project: BaseClient   File: ChunkProviderGenerate.java   Source Code and License 5 votes vote down vote up
public void replaceBlocksForBiome(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_)
{
    double d0 = 0.03125D;
    this.stoneNoise = this.field_147430_m.func_151599_a(this.stoneNoise, (double)(p_180517_1_ * 16), (double)(p_180517_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);

    for (int i = 0; i < 16; ++i)
    {
        for (int j = 0; j < 16; ++j)
        {
            BiomeGenBase biomegenbase = p_180517_4_[j + i * 16];
            biomegenbase.genTerrainBlocks(this.worldObj, this.rand, p_180517_3_, p_180517_1_ * 16 + i, p_180517_2_ * 16 + j, this.stoneNoise[j + i * 16]);
        }
    }
}
 
Example 32
Project: DecompiledMinecraft   File: ChunkProviderFlat.java   Source Code and License 5 votes vote down vote up
/**
 * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
 * specified chunk from the map seed and chunk seed
 */
public Chunk provideChunk(int x, int z)
{
    ChunkPrimer chunkprimer = new ChunkPrimer();

    for (int i = 0; i < this.cachedBlockIDs.length; ++i)
    {
        IBlockState iblockstate = this.cachedBlockIDs[i];

        if (iblockstate != null)
        {
            for (int j = 0; j < 16; ++j)
            {
                for (int k = 0; k < 16; ++k)
                {
                    chunkprimer.setBlockState(j, i, k, iblockstate);
                }
            }
        }
    }

    for (MapGenBase mapgenbase : this.structureGenerators)
    {
        mapgenbase.generate(this, this.worldObj, x, z, chunkprimer);
    }

    Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z);
    BiomeGenBase[] abiomegenbase = this.worldObj.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[])null, x * 16, z * 16, 16, 16);
    byte[] abyte = chunk.getBiomeArray();

    for (int l = 0; l < abyte.length; ++l)
    {
        abyte[l] = (byte)abiomegenbase[l].biomeID;
    }

    chunk.generateSkylightMap();
    return chunk;
}
 
Example 33
Project: DecompiledMinecraft   File: ChunkProviderGenerate.java   Source Code and License 5 votes vote down vote up
public void replaceBlocksForBiome(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_)
{
    double d0 = 0.03125D;
    this.stoneNoise = this.field_147430_m.func_151599_a(this.stoneNoise, (double)(p_180517_1_ * 16), (double)(p_180517_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);

    for (int i = 0; i < 16; ++i)
    {
        for (int j = 0; j < 16; ++j)
        {
            BiomeGenBase biomegenbase = p_180517_4_[j + i * 16];
            biomegenbase.genTerrainBlocks(this.worldObj, this.rand, p_180517_3_, p_180517_1_ * 16 + i, p_180517_2_ * 16 + j, this.stoneNoise[j + i * 16]);
        }
    }
}
 
Example 34
Project: DecompiledMinecraft   File: ChunkProviderDebug.java   Source Code and License 5 votes vote down vote up
/**
 * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
 * specified chunk from the map seed and chunk seed
 */
public Chunk provideChunk(int x, int z)
{
    ChunkPrimer chunkprimer = new ChunkPrimer();

    for (int i = 0; i < 16; ++i)
    {
        for (int j = 0; j < 16; ++j)
        {
            int k = x * 16 + i;
            int l = z * 16 + j;
            chunkprimer.setBlockState(i, 60, j, Blocks.barrier.getDefaultState());
            IBlockState iblockstate = func_177461_b(k, l);

            if (iblockstate != null)
            {
                chunkprimer.setBlockState(i, 70, j, iblockstate);
            }
        }
    }

    Chunk chunk = new Chunk(this.world, chunkprimer, x, z);
    chunk.generateSkylightMap();
    BiomeGenBase[] abiomegenbase = this.world.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[])null, x * 16, z * 16, 16, 16);
    byte[] abyte = chunk.getBiomeArray();

    for (int i1 = 0; i1 < abyte.length; ++i1)
    {
        abyte[i1] = (byte)abiomegenbase[i1].biomeID;
    }

    chunk.generateSkylightMap();
    return chunk;
}
 
Example 35
Project: BaseClient   File: CustomColorizer.java   Source Code and License 5 votes vote down vote up
private static int getCustomColor(int[] p_getCustomColor_0_, IBlockAccess p_getCustomColor_1_, BlockPos p_getCustomColor_2_)
{
    BiomeGenBase biomegenbase = p_getCustomColor_1_.getBiomeGenForCoords(p_getCustomColor_2_);
    double d0 = (double)MathHelper.clamp_float(biomegenbase.getFloatTemperature(p_getCustomColor_2_), 0.0F, 1.0F);
    double d1 = (double)MathHelper.clamp_float(biomegenbase.getFloatRainfall(), 0.0F, 1.0F);
    d1 = d1 * d0;
    int i = (int)((1.0D - d0) * 255.0D);
    int j = (int)((1.0D - d1) * 255.0D);
    return p_getCustomColor_0_[j << 8 | i] & 16777215;
}
 
Example 36
Project: BaseClient   File: CustomColorizer.java   Source Code and License 5 votes vote down vote up
private static int getCustomColor(int[] p_getCustomColor_0_, IBlockAccess p_getCustomColor_1_, BlockPos p_getCustomColor_2_)
{
    BiomeGenBase biomegenbase = p_getCustomColor_1_.getBiomeGenForCoords(p_getCustomColor_2_);
    double d0 = (double)MathHelper.clamp_float(biomegenbase.getFloatTemperature(p_getCustomColor_2_), 0.0F, 1.0F);
    double d1 = (double)MathHelper.clamp_float(biomegenbase.getFloatRainfall(), 0.0F, 1.0F);
    d1 = d1 * d0;
    int i = (int)((1.0D - d0) * 255.0D);
    int j = (int)((1.0D - d1) * 255.0D);
    return p_getCustomColor_0_[j << 8 | i] & 16777215;
}
 
Example 37
Project: BaseClient   File: RandomMobsRule.java   Source Code and License 5 votes vote down vote up
public RandomMobsRule(ResourceLocation p_i72_1_, int[] p_i72_2_, int[] p_i72_3_, BiomeGenBase[] p_i72_4_, RangeListInt p_i72_5_)
{
    this.baseResLoc = p_i72_1_;
    this.skins = p_i72_2_;
    this.weights = p_i72_3_;
    this.biomes = p_i72_4_;
    this.heights = p_i72_5_;
}
 
Example 38
Project: BaseClient   File: ConnectedParser.java   Source Code and License 5 votes vote down vote up
public BiomeGenBase findBiome(String p_findBiome_1_)
{
    p_findBiome_1_ = p_findBiome_1_.toLowerCase();

    if (p_findBiome_1_.equals("nether"))
    {
        return BiomeGenBase.hell;
    }
    else
    {
        BiomeGenBase[] abiomegenbase = BiomeGenBase.getBiomeGenArray();

        for (int i = 0; i < abiomegenbase.length; ++i)
        {
            BiomeGenBase biomegenbase = abiomegenbase[i];

            if (biomegenbase != null)
            {
                String s = biomegenbase.biomeName.replace(" ", "").toLowerCase();

                if (s.equals(p_findBiome_1_))
                {
                    return biomegenbase;
                }
            }
        }

        return null;
    }
}
 
Example 39
Project: BaseClient   File: FlatGeneratorInfo.java   Source Code and License 5 votes vote down vote up
public static FlatGeneratorInfo getDefaultFlatGenerator()
{
    FlatGeneratorInfo flatgeneratorinfo = new FlatGeneratorInfo();
    flatgeneratorinfo.setBiome(BiomeGenBase.plains.biomeID);
    flatgeneratorinfo.getFlatLayers().add(new FlatLayerInfo(1, Blocks.bedrock));
    flatgeneratorinfo.getFlatLayers().add(new FlatLayerInfo(2, Blocks.dirt));
    flatgeneratorinfo.getFlatLayers().add(new FlatLayerInfo(1, Blocks.grass));
    flatgeneratorinfo.func_82645_d();
    flatgeneratorinfo.getWorldFeatures().put("village", Maps.<String, String>newHashMap());
    return flatgeneratorinfo;
}
 
Example 40
Project: BaseClient   File: MapGenNetherBridge.java   Source Code and License 5 votes vote down vote up
public MapGenNetherBridge()
{
    this.spawnList.add(new BiomeGenBase.SpawnListEntry(EntityBlaze.class, 10, 2, 3));
    this.spawnList.add(new BiomeGenBase.SpawnListEntry(EntityPigZombie.class, 5, 4, 4));
    this.spawnList.add(new BiomeGenBase.SpawnListEntry(EntitySkeleton.class, 10, 4, 4));
    this.spawnList.add(new BiomeGenBase.SpawnListEntry(EntityMagmaCube.class, 3, 4, 4));
}
 
Example 41
Project: DecompiledMinecraft   File: World.java   Source Code and License 5 votes vote down vote up
/**
 * Checks to see if a given block is both water and cold enough to freeze.
 */
public boolean canBlockFreeze(BlockPos pos, boolean noWaterAdj)
{
    BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos);
    float f = biomegenbase.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;
    }
}
 
Example 42
Project: DecompiledMinecraft   File: World.java   Source Code and License 5 votes vote down vote up
/**
 * Checks to see if a given block can accumulate snow from it snowing
 */
public boolean canSnowAt(BlockPos pos, boolean checkLight)
{
    BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos);
    float f = biomegenbase.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)
        {
            Block block = this.getBlockState(pos).getBlock();

            if (block.getMaterial() == Material.air && Blocks.snow_layer.canPlaceBlockAt(this, pos))
            {
                return true;
            }
        }

        return false;
    }
}
 
Example 43
Project: BaseClient   File: World.java   Source Code and License 5 votes vote down vote up
/**
 * Checks to see if a given block can accumulate snow from it snowing
 */
public boolean canSnowAt(BlockPos pos, boolean checkLight)
{
    BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos);
    float f = biomegenbase.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)
        {
            Block block = this.getBlockState(pos).getBlock();

            if (block.getMaterial() == Material.air && Blocks.snow_layer.canPlaceBlockAt(this, pos))
            {
                return true;
            }
        }

        return false;
    }
}
 
Example 44
Project: BaseClient   File: CustomColors.java   Source Code and License 5 votes vote down vote up
protected static BiomeGenBase getColorBiome(IBlockAccess p_getColorBiome_0_, BlockPos p_getColorBiome_1_)
{
    BiomeGenBase biomegenbase = p_getColorBiome_0_.getBiomeGenForCoords(p_getColorBiome_1_);

    if (biomegenbase == BiomeGenBase.swampland && !Config.isSwampColors())
    {
        biomegenbase = BiomeGenBase.plains;
    }

    return biomegenbase;
}
 
Example 45
Project: BaseClient   File: World.java   Source Code and License 5 votes vote down vote up
/**
 * Checks to see if a given block can accumulate snow from it snowing
 */
public boolean canSnowAt(BlockPos pos, boolean checkLight)
{
    BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos);
    float f = biomegenbase.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)
        {
            Block block = this.getBlockState(pos).getBlock();

            if (block.getMaterial() == Material.air && Blocks.snow_layer.canPlaceBlockAt(this, pos))
            {
                return true;
            }
        }

        return false;
    }
}
 
Example 46
Project: DecompiledMinecraft   File: MapGenStronghold.java   Source Code and License 5 votes vote down vote up
public MapGenStronghold()
{
    this.structureCoords = new ChunkCoordIntPair[3];
    this.field_82671_h = 32.0D;
    this.field_82672_i = 3;
    this.field_151546_e = Lists.<BiomeGenBase>newArrayList();

    for (BiomeGenBase biomegenbase : BiomeGenBase.getBiomeGenArray())
    {
        if (biomegenbase != null && biomegenbase.minHeight > 0.0F)
        {
            this.field_151546_e.add(biomegenbase);
        }
    }
}
 
Example 47
Project: DecompiledMinecraft   File: StructureOceanMonument.java   Source Code and License 5 votes vote down vote up
protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ)
{
    int i = chunkX;
    int j = chunkZ;

    if (chunkX < 0)
    {
        chunkX -= this.field_175800_f - 1;
    }

    if (chunkZ < 0)
    {
        chunkZ -= this.field_175800_f - 1;
    }

    int k = chunkX / this.field_175800_f;
    int l = chunkZ / this.field_175800_f;
    Random random = this.worldObj.setRandomSeed(k, l, 10387313);
    k = k * this.field_175800_f;
    l = l * this.field_175800_f;
    k = k + (random.nextInt(this.field_175800_f - this.field_175801_g) + random.nextInt(this.field_175800_f - this.field_175801_g)) / 2;
    l = l + (random.nextInt(this.field_175800_f - this.field_175801_g) + random.nextInt(this.field_175800_f - this.field_175801_g)) / 2;

    if (i == k && j == l)
    {
        if (this.worldObj.getWorldChunkManager().getBiomeGenerator(new BlockPos(i * 16 + 8, 64, j * 16 + 8), (BiomeGenBase)null) != BiomeGenBase.deepOcean)
        {
            return false;
        }

        boolean flag = this.worldObj.getWorldChunkManager().areBiomesViable(i * 16 + 8, j * 16 + 8, 29, field_175802_d);

        if (flag)
        {
            return true;
        }
    }

    return false;
}
 
Example 48
Project: BaseClient   File: EntitySlime.java   Source Code and License 5 votes vote down vote up
/**
 * Checks if the entity's current position is a valid location to spawn this entity.
 */
public boolean getCanSpawnHere()
{
    BlockPos blockpos = new BlockPos(MathHelper.floor_double(this.posX), 0, MathHelper.floor_double(this.posZ));
    Chunk chunk = this.worldObj.getChunkFromBlockCoords(blockpos);

    if (this.worldObj.getWorldInfo().getTerrainType() == WorldType.FLAT && this.rand.nextInt(4) != 1)
    {
        return false;
    }
    else
    {
        if (this.worldObj.getDifficulty() != EnumDifficulty.PEACEFUL)
        {
            BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(blockpos);

            if (biomegenbase == BiomeGenBase.swampland && this.posY > 50.0D && this.posY < 70.0D && this.rand.nextFloat() < 0.5F && this.rand.nextFloat() < this.worldObj.getCurrentMoonPhaseFactor() && this.worldObj.getLightFromNeighbors(new BlockPos(this)) <= this.rand.nextInt(8))
            {
                return super.getCanSpawnHere();
            }

            if (this.rand.nextInt(10) == 0 && chunk.getRandomWithSeed(987234911L).nextInt(10) == 0 && this.posY < 40.0D)
            {
                return super.getCanSpawnHere();
            }
        }

        return false;
    }
}
 
Example 49
Project: DecompiledMinecraft   File: FlatGeneratorInfo.java   Source Code and License 5 votes vote down vote up
public static FlatGeneratorInfo getDefaultFlatGenerator()
{
    FlatGeneratorInfo flatgeneratorinfo = new FlatGeneratorInfo();
    flatgeneratorinfo.setBiome(BiomeGenBase.plains.biomeID);
    flatgeneratorinfo.getFlatLayers().add(new FlatLayerInfo(1, Blocks.bedrock));
    flatgeneratorinfo.getFlatLayers().add(new FlatLayerInfo(2, Blocks.dirt));
    flatgeneratorinfo.getFlatLayers().add(new FlatLayerInfo(1, Blocks.grass));
    flatgeneratorinfo.func_82645_d();
    flatgeneratorinfo.getWorldFeatures().put("village", Maps.<String, String>newHashMap());
    return flatgeneratorinfo;
}
 
Example 50
Project: DecompiledMinecraft   File: ChunkProviderFlat.java   Source Code and License 5 votes vote down vote up
/**
 * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
 * specified chunk from the map seed and chunk seed
 */
public Chunk provideChunk(int x, int z)
{
    ChunkPrimer chunkprimer = new ChunkPrimer();

    for (int i = 0; i < this.cachedBlockIDs.length; ++i)
    {
        IBlockState iblockstate = this.cachedBlockIDs[i];

        if (iblockstate != null)
        {
            for (int j = 0; j < 16; ++j)
            {
                for (int k = 0; k < 16; ++k)
                {
                    chunkprimer.setBlockState(j, i, k, iblockstate);
                }
            }
        }
    }

    for (MapGenBase mapgenbase : this.structureGenerators)
    {
        mapgenbase.generate(this, this.worldObj, x, z, chunkprimer);
    }

    Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z);
    BiomeGenBase[] abiomegenbase = this.worldObj.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[])null, x * 16, z * 16, 16, 16);
    byte[] abyte = chunk.getBiomeArray();

    for (int l = 0; l < abyte.length; ++l)
    {
        abyte[l] = (byte)abiomegenbase[l].biomeID;
    }

    chunk.generateSkylightMap();
    return chunk;
}
 
Example 51
Project: BaseClient   File: ConnectedProperties.java   Source Code and License 5 votes vote down vote up
private static BiomeGenBase[] parseBiomes(String p_parseBiomes_0_)
{
    if (p_parseBiomes_0_ == null)
    {
        return null;
    }
    else
    {
        String[] astring = Config.tokenize(p_parseBiomes_0_, " ");
        List list = new ArrayList();

        for (int i = 0; i < astring.length; ++i)
        {
            String s = astring[i];
            BiomeGenBase biomegenbase = findBiome(s);

            if (biomegenbase == null)
            {
                Config.warn("Biome not found: " + s);
            }
            else
            {
                list.add(biomegenbase);
            }
        }

        BiomeGenBase[] abiomegenbase = (BiomeGenBase[])((BiomeGenBase[])list.toArray(new BiomeGenBase[list.size()]));
        return abiomegenbase;
    }
}
 
Example 52
Project: DecompiledMinecraft   File: ChunkProviderDebug.java   Source Code and License 5 votes vote down vote up
/**
 * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
 * specified chunk from the map seed and chunk seed
 */
public Chunk provideChunk(int x, int z)
{
    ChunkPrimer chunkprimer = new ChunkPrimer();

    for (int i = 0; i < 16; ++i)
    {
        for (int j = 0; j < 16; ++j)
        {
            int k = x * 16 + i;
            int l = z * 16 + j;
            chunkprimer.setBlockState(i, 60, j, Blocks.barrier.getDefaultState());
            IBlockState iblockstate = func_177461_b(k, l);

            if (iblockstate != null)
            {
                chunkprimer.setBlockState(i, 70, j, iblockstate);
            }
        }
    }

    Chunk chunk = new Chunk(this.world, chunkprimer, x, z);
    chunk.generateSkylightMap();
    BiomeGenBase[] abiomegenbase = this.world.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[])null, x * 16, z * 16, 16, 16);
    byte[] abyte = chunk.getBiomeArray();

    for (int i1 = 0; i1 < abyte.length; ++i1)
    {
        abyte[i1] = (byte)abiomegenbase[i1].biomeID;
    }

    chunk.generateSkylightMap();
    return chunk;
}
 
Example 53
Project: BaseClient   File: WorldProviderEnd.java   Source Code and License 5 votes vote down vote up
/**
 * creates a new world chunk manager for WorldProvider
 */
public void registerWorldChunkManager()
{
    this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.sky, 0.0F);
    this.dimensionId = 1;
    this.hasNoSky = true;
}
 
Example 54
Project: BaseClient   File: EntitySlime.java   Source Code and License 5 votes vote down vote up
/**
 * Checks if the entity's current position is a valid location to spawn this entity.
 */
public boolean getCanSpawnHere()
{
    BlockPos blockpos = new BlockPos(MathHelper.floor_double(this.posX), 0, MathHelper.floor_double(this.posZ));
    Chunk chunk = this.worldObj.getChunkFromBlockCoords(blockpos);

    if (this.worldObj.getWorldInfo().getTerrainType() == WorldType.FLAT && this.rand.nextInt(4) != 1)
    {
        return false;
    }
    else
    {
        if (this.worldObj.getDifficulty() != EnumDifficulty.PEACEFUL)
        {
            BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(blockpos);

            if (biomegenbase == BiomeGenBase.swampland && this.posY > 50.0D && this.posY < 70.0D && this.rand.nextFloat() < 0.5F && this.rand.nextFloat() < this.worldObj.getCurrentMoonPhaseFactor() && this.worldObj.getLightFromNeighbors(new BlockPos(this)) <= this.rand.nextInt(8))
            {
                return super.getCanSpawnHere();
            }

            if (this.rand.nextInt(10) == 0 && chunk.getRandomWithSeed(987234911L).nextInt(10) == 0 && this.posY < 40.0D)
            {
                return super.getCanSpawnHere();
            }
        }

        return false;
    }
}
 
Example 55
Project: BaseClient   File: GenLayerRiverMix.java   Source Code and License 5 votes vote down vote up
/**
 * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
 * amounts, or biomeList[] indices based on the particular GenLayer subclass.
 */
public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight)
{
    int[] aint = this.biomePatternGeneratorChain.getInts(areaX, areaY, areaWidth, areaHeight);
    int[] aint1 = this.riverPatternGeneratorChain.getInts(areaX, areaY, areaWidth, areaHeight);
    int[] aint2 = IntCache.getIntCache(areaWidth * areaHeight);

    for (int i = 0; i < areaWidth * areaHeight; ++i)
    {
        if (aint[i] != BiomeGenBase.ocean.biomeID && aint[i] != BiomeGenBase.deepOcean.biomeID)
        {
            if (aint1[i] == BiomeGenBase.river.biomeID)
            {
                if (aint[i] == BiomeGenBase.icePlains.biomeID)
                {
                    aint2[i] = BiomeGenBase.frozenRiver.biomeID;
                }
                else if (aint[i] != BiomeGenBase.mushroomIsland.biomeID && aint[i] != BiomeGenBase.mushroomIslandShore.biomeID)
                {
                    aint2[i] = aint1[i] & 255;
                }
                else
                {
                    aint2[i] = BiomeGenBase.mushroomIslandShore.biomeID;
                }
            }
            else
            {
                aint2[i] = aint[i];
            }
        }
        else
        {
            aint2[i] = aint[i];
        }
    }

    return aint2;
}
 
Example 56
Project: DecompiledMinecraft   File: GenLayerRiver.java   Source Code and License 5 votes vote down vote up
/**
 * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
 * amounts, or biomeList[] indices based on the particular GenLayer subclass.
 */
public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight)
{
    int i = areaX - 1;
    int j = areaY - 1;
    int k = areaWidth + 2;
    int l = areaHeight + 2;
    int[] aint = this.parent.getInts(i, j, k, l);
    int[] aint1 = IntCache.getIntCache(areaWidth * areaHeight);

    for (int i1 = 0; i1 < areaHeight; ++i1)
    {
        for (int j1 = 0; j1 < areaWidth; ++j1)
        {
            int k1 = this.func_151630_c(aint[j1 + 0 + (i1 + 1) * k]);
            int l1 = this.func_151630_c(aint[j1 + 2 + (i1 + 1) * k]);
            int i2 = this.func_151630_c(aint[j1 + 1 + (i1 + 0) * k]);
            int j2 = this.func_151630_c(aint[j1 + 1 + (i1 + 2) * k]);
            int k2 = this.func_151630_c(aint[j1 + 1 + (i1 + 1) * k]);

            if (k2 == k1 && k2 == i2 && k2 == l1 && k2 == j2)
            {
                aint1[j1 + i1 * areaWidth] = -1;
            }
            else
            {
                aint1[j1 + i1 * areaWidth] = BiomeGenBase.river.biomeID;
            }
        }
    }

    return aint1;
}
 
Example 57
Project: DecompiledMinecraft   File: World.java   Source Code and License 5 votes vote down vote up
public BiomeGenBase getBiomeGenForCoords(final BlockPos pos)
{
    if (this.isBlockLoaded(pos))
    {
        Chunk chunk = this.getChunkFromBlockCoords(pos);

        try
        {
            return chunk.getBiome(pos, this.provider.getWorldChunkManager());
        }
        catch (Throwable throwable)
        {
            CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Getting biome");
            CrashReportCategory crashreportcategory = crashreport.makeCategory("Coordinates of biome request");
            crashreportcategory.addCrashSectionCallable("Location", new Callable<String>()
            {
                public String call() throws Exception
                {
                    return CrashReportCategory.getCoordinateInfo(pos);
                }
            });
            throw new ReportedException(crashreport);
        }
    }
    else
    {
        return this.provider.getWorldChunkManager().getBiomeGenerator(pos, BiomeGenBase.plains);
    }
}
 
Example 58
Project: BaseClient   File: GenLayerRiverMix.java   Source Code and License 5 votes vote down vote up
/**
 * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
 * amounts, or biomeList[] indices based on the particular GenLayer subclass.
 */
public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight)
{
    int[] aint = this.biomePatternGeneratorChain.getInts(areaX, areaY, areaWidth, areaHeight);
    int[] aint1 = this.riverPatternGeneratorChain.getInts(areaX, areaY, areaWidth, areaHeight);
    int[] aint2 = IntCache.getIntCache(areaWidth * areaHeight);

    for (int i = 0; i < areaWidth * areaHeight; ++i)
    {
        if (aint[i] != BiomeGenBase.ocean.biomeID && aint[i] != BiomeGenBase.deepOcean.biomeID)
        {
            if (aint1[i] == BiomeGenBase.river.biomeID)
            {
                if (aint[i] == BiomeGenBase.icePlains.biomeID)
                {
                    aint2[i] = BiomeGenBase.frozenRiver.biomeID;
                }
                else if (aint[i] != BiomeGenBase.mushroomIsland.biomeID && aint[i] != BiomeGenBase.mushroomIslandShore.biomeID)
                {
                    aint2[i] = aint1[i] & 255;
                }
                else
                {
                    aint2[i] = BiomeGenBase.mushroomIslandShore.biomeID;
                }
            }
            else
            {
                aint2[i] = aint[i];
            }
        }
        else
        {
            aint2[i] = aint[i];
        }
    }

    return aint2;
}
 
Example 59
Project: BaseClient   File: MapGenStronghold.java   Source Code and License 5 votes vote down vote up
public MapGenStronghold()
{
    this.structureCoords = new ChunkCoordIntPair[3];
    this.field_82671_h = 32.0D;
    this.field_82672_i = 3;
    this.field_151546_e = Lists.<BiomeGenBase>newArrayList();

    for (BiomeGenBase biomegenbase : BiomeGenBase.getBiomeGenArray())
    {
        if (biomegenbase != null && biomegenbase.minHeight > 0.0F)
        {
            this.field_151546_e.add(biomegenbase);
        }
    }
}
 
Example 60
Project: Uranium   File: CraftBlock.java   Source Code and License 4 votes vote down vote up
public static BiomeGenBase biomeToBiomeBase(Biome bio) {
    if (bio == null) {
        return null;
    }
    return BIOMEBASE_MAPPING[bio.ordinal()];
}