Skip to content

Instantly share code, notes, and snippets.

@Deamon5550
Created January 6, 2013 05:35
Show Gist options
  • Save Deamon5550/4465454 to your computer and use it in GitHub Desktop.
Save Deamon5550/4465454 to your computer and use it in GitHub Desktop.
WorldGen
package net.minecraft.server.v1_4_6;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public abstract class BiomeBase
{
/** An array of all the biomes, indexed by biome id. */
public static final BiomeBase[] biomes = new BiomeBase[256];
//=====================================================================================================================
//set oceans, swamps, and jungles to forests and mountains respectively
//=====================================================================================================================
public static final BiomeBase OCEAN = (new BiomeForest(0)).b(353825).a("Forest").a(5159473).a(0.7F, 0.8F);
public static final BiomeBase PLAINS = (new BiomePlains(1)).b(9286496).a("Plains").a(0.8F, 0.4F);
public static final BiomeBase DESERT = (new BiomeDesert(2)).b(16421912).a("Desert").m().a(2.0F, 0.0F).b(0.1F, 0.2F);
public static final BiomeBase EXTREME_HILLS = (new BiomeBigHills(3)).b(6316128).a("Extreme Hills").b(0.3F, 1.5F).a(0.2F, 0.3F);
public static final BiomeBase FOREST = (new BiomeForest(4)).b(353825).a("Forest").a(5159473).a(0.7F, 0.8F);
public static final BiomeBase TAIGA = (new BiomeTaiga(5)).b(747097).a("Taiga").a(5159473).b().a(0.05F, 0.8F).b(0.1F, 0.4F);
public static final BiomeBase SWAMPLAND = (new BiomeForest(6)).b(353825).a("Forest").a(5159473).a(0.7F, 0.8F);
public static final BiomeBase RIVER = (new BiomeRiver(7)).b(255).a("River").b(-0.5F, 0.0F);
public static final BiomeBase HELL = (new BiomeHell(8)).b(16711680).a("Hell").m().a(2.0F, 0.0F);
/** Is the biome used for sky world. */
public static final BiomeBase SKY = (new BiomeTheEnd(9)).b(8421631).a("Sky").m();
public static final BiomeBase FROZEN_OCEAN = (new BiomeOcean(10)).b(9474208).a("FrozenOcean").b().b(-1.0F, 0.5F).a(0.0F, 0.5F);
public static final BiomeBase FROZEN_RIVER = (new BiomeRiver(11)).b(10526975).a("FrozenRiver").b().b(-0.5F, 0.0F).a(0.0F, 0.5F);
public static final BiomeBase ICE_PLAINS = (new BiomeIcePlains(12)).b(16777215).a("Ice Plains").b().a(0.0F, 0.5F);
public static final BiomeBase ICE_MOUNTAINS = (new BiomeIcePlains(13)).b(10526880).a("Ice Mountains").b().b(0.3F, 1.3F).a(0.0F, 0.5F);
public static final BiomeBase MUSHROOM_ISLAND = (new BiomeMushrooms(14)).b(16711935).a("MushroomIsland").a(0.9F, 1.0F).b(0.2F, 1.0F);
public static final BiomeBase MUSHROOM_SHORE = (new BiomeMushrooms(15)).b(10486015).a("MushroomIslandShore").a(0.9F, 1.0F).b(-1.0F, 0.1F);
/** Beach biome. */
public static final BiomeBase BEACH = (new BiomeBeach(16)).b(16440917).a("Beach").a(0.8F, 0.4F).b(0.0F, 0.1F);
/** Desert Hills biome. */
public static final BiomeBase DESERT_HILLS = (new BiomeDesert(17)).b(13786898).a("DesertHills").m().a(2.0F, 0.0F).b(0.3F, 0.8F);
/** Forest Hills biome. */
public static final BiomeBase FOREST_HILLS = (new BiomeForest(18)).b(2250012).a("ForestHills").a(5159473).a(0.7F, 0.8F).b(0.3F, 0.7F);
/** Taiga Hills biome. */
public static final BiomeBase TAIGA_HILLS = (new BiomeTaiga(19)).b(1456435).a("TaigaHills").b().a(5159473).a(0.05F, 0.8F).b(0.3F, 0.8F);
/** Extreme Hills Edge biome. */
public static final BiomeBase SMALL_MOUNTAINS = (new BiomeBigHills(20)).b(7501978).a("Extreme Hills Edge").b(0.2F, 0.8F).a(0.2F, 0.3F);
/** Jungle biome identifier */
public static final BiomeBase JUNGLE = (new BiomeBigHills(21)).b(6316128).a("Extreme Hills").b(0.3F, 1.5F).a(0.2F, 0.3F);
public static final BiomeBase JUNGLE_HILLS = (new BiomeBigHills(22)).b(6316128).a("Extreme Hills").b(0.3F, 1.5F).a(0.2F, 0.3F);
public String y;
public int z;
/** The block expected to be on the top of this biome */
public byte A;
/** The block to fill spots in when not on the top */
public byte B;
public int C;
/** The minimum height of this biome. Default 0.1. */
public float D;
/** The maximum height of this biome. Default 0.3. */
public float E;
/** The temperature of this biome. */
public float temperature;
/** The rainfall in this biome. */
public float humidity;
/** Color tint applied to water depending on biome */
public int H;
/** The biome decorator. */
public net.minecraft.server.v1_4_6.BiomeDecorator I;
/**
* Holds the classes of IMobs (hostile mobs) that can be spawned in the biome.
*/
protected List J;
/**
* Holds the classes of any creature that can be spawned in the biome as friendly creature.
*/
protected List K;
/**
* Holds the classes of any aquatic creature that can be spawned in the water of the biome.
*/
protected List L;
protected List M;
/** Set to true if snow is enabled for this biome. */
private boolean S;
/**
* Is true (default) if the biome support rain (desert and nether can't have rain)
*/
private boolean T;
/** The id number to this biome, and its index in the biomeList array. */
public final int id;
/** The tree generator. */
protected net.minecraft.server.v1_4_6.WorldGenTrees O;
/** The big tree generator. */
protected net.minecraft.server.v1_4_6.WorldGenBigTree P;
/** The forest generator. */
protected net.minecraft.server.v1_4_6.WorldGenForest Q;
/** The swamp tree generator. */
protected net.minecraft.server.v1_4_6.WorldGenSwampTree R;
protected BiomeBase(int i)
{
this.A = (byte)Block.GRASS.id;
this.B = (byte)Block.DIRT.id;
this.C = 5169201;
this.D = 0.1F;
this.E = 0.3F;
this.temperature = 0.5F;
this.humidity = 0.5F;
this.H = 16777215;
this.J = new ArrayList();
this.K = new ArrayList();
this.L = new ArrayList();
this.M = new ArrayList();
this.T = true;
this.O = new net.minecraft.server.v1_4_6.WorldGenTrees(false);
this.P = new net.minecraft.server.v1_4_6.WorldGenBigTree(false);
this.Q = new net.minecraft.server.v1_4_6.WorldGenForest(false);
this.R = new net.minecraft.server.v1_4_6.WorldGenSwampTree();
this.id = i;
biomes[i] = this;
this.I = this.a();
this.K.add(new net.minecraft.server.v1_4_6.BiomeMeta(net.minecraft.server.v1_4_6.EntitySheep.class, 12, 4, 4));
this.K.add(new net.minecraft.server.v1_4_6.BiomeMeta(net.minecraft.server.v1_4_6.EntityPig.class, 10, 4, 4));
this.K.add(new net.minecraft.server.v1_4_6.BiomeMeta(net.minecraft.server.v1_4_6.EntityChicken.class, 10, 4, 4));
this.K.add(new net.minecraft.server.v1_4_6.BiomeMeta(net.minecraft.server.v1_4_6.EntityCow.class, 8, 4, 4));
this.J.add(new net.minecraft.server.v1_4_6.BiomeMeta(net.minecraft.server.v1_4_6.EntitySpider.class, 10, 4, 4));
this.J.add(new net.minecraft.server.v1_4_6.BiomeMeta(net.minecraft.server.v1_4_6.EntityZombie.class, 10, 4, 4));
this.J.add(new net.minecraft.server.v1_4_6.BiomeMeta(net.minecraft.server.v1_4_6.EntitySkeleton.class, 10, 4, 4));
this.J.add(new net.minecraft.server.v1_4_6.BiomeMeta(net.minecraft.server.v1_4_6.EntityCreeper.class, 10, 4, 4));
this.J.add(new net.minecraft.server.v1_4_6.BiomeMeta(net.minecraft.server.v1_4_6.EntitySlime.class, 10, 4, 4));
this.J.add(new net.minecraft.server.v1_4_6.BiomeMeta(net.minecraft.server.v1_4_6.EntityEnderman.class, 1, 1, 4));
this.L.add(new net.minecraft.server.v1_4_6.BiomeMeta(net.minecraft.server.v1_4_6.EntitySquid.class, 10, 4, 4));
this.M.add(new net.minecraft.server.v1_4_6.BiomeMeta(net.minecraft.server.v1_4_6.EntityBat.class, 10, 8, 8));
}
/**
* Allocate a new BiomeDecorator for this BiomeGenBase
*/
protected net.minecraft.server.v1_4_6.BiomeDecorator a()
{
return new net.minecraft.server.v1_4_6.BiomeDecorator(this);
}
/**
* Sets the temperature and rainfall of this biome.
*/
private BiomeBase a(float par1, float par2)
{
if (par1 > 0.1F && par1 < 0.2F)
{
throw new IllegalArgumentException("Please avoid temperatures in the range 0.1 - 0.2 because of snow");
}
else
{
this.temperature = par1;
this.humidity = par2;
return this;
}
}
/**
* Sets the minimum and maximum height of this biome. Seems to go from -2.0 to 2.0.
*/
private BiomeBase b(float par1, float par2)
{
this.D = par1;
this.E = par2;
return this;
}
/**
* Disable the rain for the biome.
*/
private BiomeBase m()
{
this.T = false;
return this;
}
/**
* Gets a WorldGen appropriate for this biome.
*/
public WorldGenerator a(Random par1Random)
{
return (WorldGenerator)(par1Random.nextInt(10) == 0 ? this.P : this.O);
}
/**
* Gets a WorldGen appropriate for this biome.
*/
public WorldGenerator b(Random par1Random)
{
return new net.minecraft.server.v1_4_6.WorldGenGrass(Block.LONG_GRASS.id, 1);
}
/**
* sets enableSnow to true during biome initialization. returns BiomeGenBase.
*/
protected BiomeBase b()
{
this.S = true;
return this;
}
protected BiomeBase a(String par1Str)
{
this.y = par1Str;
return this;
}
protected BiomeBase a(int par1)
{
this.C = par1;
return this;
}
protected BiomeBase b(int par1)
{
this.z = par1;
return this;
}
/**
* Returns the correspondent list of the EnumCreatureType informed.
*/
public List getMobs(net.minecraft.server.v1_4_6.EnumCreatureType par1EnumCreatureType)
{
return par1EnumCreatureType == EnumCreatureType.MONSTER ? this.J : (par1EnumCreatureType == EnumCreatureType.CREATURE ? this.K : (par1EnumCreatureType == EnumCreatureType.WATER_CREATURE ? this.L : (par1EnumCreatureType == EnumCreatureType.AMBIENT ? this.M : null)));
}
/**
* Returns true if the biome have snowfall instead a normal rain.
*/
public boolean c()
{
return this.S;
}
/**
* Return true if the biome supports lightning bolt spawn, either by have the bolts enabled and have rain enabled.
*/
public boolean d()
{
return this.S ? false : this.T;
}
/**
* Checks to see if the rainfall level of the biome is extremely high
*/
public boolean e()
{
return this.humidity > 0.85F;
}
/**
* returns the chance a creature has to spawn.
*/
public float f()
{
return 0.1F;
}
/**
* Gets an integer representation of this biome's rainfall
*/
public final int g()
{
return (int)(this.humidity * 65536.0F);
}
/**
* Gets an integer representation of this biome's temperature
*/
public final int h()
{
return (int)(this.temperature * 65536.0F);
}
/**
* Gets a floating point representation of this biome's temperature
*/
public final float j()
{
return this.temperature;
}
public void a(World par1World, Random par2Random, int par3, int par4)
{
this.I.a(par1World, par2Random, par3, par4);
}
}
package net.minecraft.server.v1_4_6;
import java.util.List;
import java.util.Random;
public class ChunkProviderGenerate implements IChunkProvider
{
/** RNG. */
private Random k;
/** A NoiseGeneratorOctaves used in generating terrain */
private net.minecraft.server.v1_4_6.NoiseGeneratorOctaves l;
/** A NoiseGeneratorOctaves used in generating terrain */
private net.minecraft.server.v1_4_6.NoiseGeneratorOctaves m;
/** A NoiseGeneratorOctaves used in generating terrain */
private net.minecraft.server.v1_4_6.NoiseGeneratorOctaves n;
/** A NoiseGeneratorOctaves used in generating terrain */
private net.minecraft.server.v1_4_6.NoiseGeneratorOctaves o;
/** A NoiseGeneratorOctaves used in generating terrain */
public net.minecraft.server.v1_4_6.NoiseGeneratorOctaves a;
/** A NoiseGeneratorOctaves used in generating terrain */
public net.minecraft.server.v1_4_6.NoiseGeneratorOctaves b;
public net.minecraft.server.v1_4_6.NoiseGeneratorOctaves c;
/** Reference to the World object. */
private World p;
/** are map structures going to be generated (e.g. strongholds) */
private final boolean q;
/** Holds the overall noise array used in chunk generation */
private double[] r;
private double[] s = new double[256];
private WorldGenBase t = new WorldGenCaves();
/** Holds Stronghold Generator */
private WorldGenStronghold u = new WorldGenStronghold();
/** Holds Village Generator */
private WorldGenVillage v = new WorldGenVillage();
/** Holds Mineshaft Generator */
private WorldGenMineshaft w = new WorldGenMineshaft();
private WorldGenLargeFeature x = new WorldGenLargeFeature();
/** Holds ravine generator */
private WorldGenBase y = new WorldGenCanyon();
/** The biomes that are used to generate the chunk */
private BiomeBase[] z;
/** A double array that hold terrain noise from noiseGen3 */
double[] d;
/** A double array that hold terrain noise */
double[] e;
/** A double array that hold terrain noise from noiseGen2 */
double[] f;
/** A double array that hold terrain noise from noiseGen5 */
double[] g;
/** A double array that holds terrain noise from noiseGen6 */
double[] h;
/**
* Used to store the 5x5 parabolic field that is used during terrain generation.
*/
float[] i;
int[][] j = new int[32][32];
public ChunkProviderGenerate(World par1World, long par2, boolean par4)
{
this.p = par1World;
this.q = par4;
this.k = new Random(par2);
this.l = new NoiseGeneratorOctaves(this.k, 16);
this.m = new NoiseGeneratorOctaves(this.k, 16);
this.n = new NoiseGeneratorOctaves(this.k, 8);
this.o = new NoiseGeneratorOctaves(this.k, 4);
this.a = new NoiseGeneratorOctaves(this.k, 10);
this.b = new NoiseGeneratorOctaves(this.k, 16);
this.c = new NoiseGeneratorOctaves(this.k, 8);
}
/**
* Generates the shape of the terrain for the chunk though its all stone though the water is frozen if the
* temperature is low enough
*/
public void a(int i1, int j1, byte[] abyte0)
{
byte var4 = 4;
byte var5 = 16;
byte var6 = 32;
int var7 = var4 + 1;
byte var8 = 17;
int var9 = var4 + 1;
this.z = this.p.getWorldChunkManager().getBiomes(this.z, i1 * 4 - 2, j1 * 4 - 2, var7 + 5, var9 + 5);
this.r = this.a(this.r, i1 * var4, 0, j1 * var4, var7, var8, var9);
for (int var10 = 0; var10 < var4; ++var10)
{
for (int var11 = 0; var11 < var4; ++var11)
{
for (int var12 = 0; var12 < var5; ++var12)
{
double var13 = 0.125D;
double var15 = this.r[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 0];
double var17 = this.r[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 0];
double var19 = this.r[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 0];
double var21 = this.r[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 0];
double var23 = (this.r[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 1] - var15) * var13;
double var25 = (this.r[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 1] - var17) * var13;
double var27 = (this.r[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 1] - var19) * var13;
double var29 = (this.r[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 1] - var21) * var13;
for (int var31 = 0; var31 < 8; ++var31)
{
double var32 = 0.25D;
double var34 = var15;
double var36 = var17;
double var38 = (var19 - var15) * var32;
double var40 = (var21 - var17) * var32;
for (int var42 = 0; var42 < 4; ++var42)
{
//=====================================================================================================================
//var12 * 5 + var31; this snippet from the line below controls the level that the world generates at
//=====================================================================================================================
int var43 = var42 + var10 * 4 << 11 | 0 + var11 * 4 << 7 | var12 * 5 + var31;
short var44 = 128;
var43 -= var44;
double var45 = 0.25D;
double var49 = (var36 - var34) * var45;
double var47 = var34 - var49;
for (int var51 = 0; var51 < 4; ++var51)
{
if ((var47 += var49) > 0.0D)
{
abyte0[var43 += var44] = (byte)Block.STONE.id;
}
//=====================================================================================================================
//line below modified to fix sealevel
//=====================================================================================================================
else if (var12 * 4 + var31 < var6)
{
abyte0[var43 += var44] = (byte)Block.STATIONARY_WATER.id;
}
else
{
abyte0[var43 += var44] = 0;
}
}
var34 += var38;
var36 += var40;
}
var15 += var23;
var17 += var25;
var19 += var27;
var21 += var29;
}
}
}
}
}
/**
* Replaces the stone that was placed in with blocks that match the biome
*/
public void a(int par1, int par2, byte[] par3ArrayOfByte, BiomeBase[] par4ArrayOfBiomeGenBase)
{
//=====================================================================================================================
//var5 is sealevel
//=====================================================================================================================
byte var5 = 39;
double var6 = 0.03125D;
this.s = this.o.a(this.s, par1 * 16, par2 * 16, 0, 16, 16, 1, var6 * 2.0D, var6 * 2.0D, var6 * 2.0D);
for (int var8 = 0; var8 < 16; ++var8)
{
for (int var9 = 0; var9 < 16; ++var9)
{
BiomeBase var10 = par4ArrayOfBiomeGenBase[var9 + var8 * 16];
float var11 = var10.j();
int var12 = (int)(this.s[var8 + var9 * 16] / 3.0D + 3.0D + this.k.nextDouble() * 0.25D);
int var13 = -1;
byte var14 = var10.A;
byte var15 = var10.B;
for (int var16 = 127; var16 >= 0; --var16)
{
int var17 = (var9 * 16 + var8) * 128 + var16;
if (var16 <= 0 + this.k.nextInt(5))
{
par3ArrayOfByte[var17] = (byte)Block.BEDROCK.id;
}
else
{
byte var18 = par3ArrayOfByte[var17];
if (var18 == 0)
{
var13 = -1;
}
else if (var18 == Block.STONE.id)
{
if (var13 == -1)
{
if (var12 <= 0)
{
var14 = 0;
var15 = (byte)Block.STONE.id;
}
else if (var16 >= var5 - 4 && var16 <= var5 + 1)
{
var14 = var10.A;
var15 = var10.B;
}
if (var16 < var5 && var14 == 0)
{
if (var11 < 0.15F)
{
var14 = (byte)Block.ICE.id;
}
else
{
var14 = (byte)Block.STATIONARY_WATER.id;
}
}
var13 = var12;
if (var16 >= var5 - 1)
{
par3ArrayOfByte[var17] = var14;
}
else
{
par3ArrayOfByte[var17] = var15;
}
}
else if (var13 > 0)
{
--var13;
par3ArrayOfByte[var17] = var15;
if (var13 == 0 && var15 == Block.SAND.id)
{
var13 = this.k.nextInt(4);
var15 = (byte)Block.SANDSTONE.id;
}
}
}
}
}
}
}
}
/**
* loads or generates the chunk at the chunk location specified
*/
public Chunk getChunkAt(int par1, int par2)
{
return this.getOrCreateChunk(par1, par2);
}
/**
* 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 getOrCreateChunk(int par1, int par2)
{
this.k.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L);
byte[] var3 = new byte[32768];
this.a(par1, par2, var3);
this.z = this.p.getWorldChunkManager().getBiomeBlock(this.z, par1 * 16, par2 * 16, 16, 16);
this.a(par1, par2, var3, this.z);
//=====================================================================================================================
//removed village/stronghold/cave/ravine generations here
//=====================================================================================================================
Chunk var4 = new Chunk(this.p, var3, par1, par2);
byte[] var5 = var4.m();
for (int var6 = 0; var6 < var5.length; ++var6)
{
var5[var6] = (byte)this.z[var6].id;
}
var4.initLighting();
return var4;
}
/**
* generates a subset of the level's terrain data. Takes 7 arguments: the [empty] noise array, the position, and the
* size.
*/
private double[] a(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7)
{
if (par1ArrayOfDouble == null)
{
par1ArrayOfDouble = new double[par5 * par6 * par7];
}
if (this.i == null)
{
this.i = new float[25];
for (int var8 = -2; var8 <= 2; ++var8)
{
for (int var9 = -2; var9 <= 2; ++var9)
{
float var10 = 10.0F / MathHelper.c((float)(var8 * var8 + var9 * var9) + 0.2F);
this.i[var8 + 2 + (var9 + 2) * 5] = var10;
}
}
}
double var44 = 684.412D;
double var45 = 684.412D;
this.g = this.a.a(this.g, par2, par4, par5, par7, 1.121D, 1.121D, 0.5D);
this.h = this.b.a(this.h, par2, par4, par5, par7, 200.0D, 200.0D, 0.5D);
this.d = this.n.a(this.d, par2, par3, par4, par5, par6, par7, var44 / 80.0D, var45 / 160.0D, var44 / 80.0D);
this.e = this.l.a(this.e, par2, par3, par4, par5, par6, par7, var44, var45, var44);
this.f = this.m.a(this.f, par2, par3, par4, par5, par6, par7, var44, var45, var44);
boolean var43 = false;
boolean var42 = false;
int var12 = 0;
int var13 = 0;
for (int var14 = 0; var14 < par5; ++var14)
{
for (int var15 = 0; var15 < par7; ++var15)
{
float var16 = 0.0F;
float var17 = 0.0F;
float var18 = 0.0F;
byte var19 = 2;
BiomeBase var20 = this.z[var14 + 2 + (var15 + 2) * (par5 + 5)];
for (int var21 = -var19; var21 <= var19; ++var21)
{
for (int var22 = -var19; var22 <= var19; ++var22)
{
BiomeBase var23 = this.z[var14 + var21 + 2 + (var15 + var22 + 2) * (par5 + 5)];
float var24 = this.i[var21 + 2 + (var22 + 2) * 5] / (var23.D + 2.0F);
if (var23.D > var20.D)
{
var24 /= 2.0F;
}
var16 += var23.E * var24;
var17 += var23.D * var24;
var18 += var24;
}
}
var16 /= var18;
var17 /= var18;
var16 = var16 * 0.9F + 0.1F;
var17 = (var17 * 4.0F - 1.0F) / 8.0F;
double var47 = this.h[var13] / 8000.0D;
if (var47 < 0.0D)
{
var47 = -var47 * 0.3D;
}
var47 = var47 * 3.0D - 2.0D;
if (var47 < 0.0D)
{
var47 /= 2.0D;
if (var47 < -1.0D)
{
var47 = -1.0D;
}
var47 /= 1.4D;
var47 /= 2.0D;
}
else
{
if (var47 > 1.0D)
{
var47 = 1.0D;
}
var47 /= 8.0D;
}
++var13;
for (int var46 = 0; var46 < par6; ++var46)
{
double var48 = (double)var17;
double var26 = (double)var16;
var48 += var47 * 0.2D;
var48 = var48 * (double)par6 / 16.0D;
double var28 = (double)par6 / 2.0D + var48 * 4.0D;
double var30 = 0.0D;
double var32 = ((double)var46 - var28) * 12.0D * 128.0D / 128.0D / var26;
if (var32 < 0.0D)
{
var32 *= 4.0D;
}
double var34 = this.e[var12] / 512.0D;
double var36 = this.f[var12] / 512.0D;
double var38 = (this.d[var12] / 10.0D + 1.0D) / 2.0D;
if (var38 < 0.0D)
{
var30 = var34;
}
else if (var38 > 1.0D)
{
var30 = var36;
}
else
{
var30 = var34 + (var36 - var34) * var38;
}
var30 -= var32;
if (var46 > par6 - 4)
{
double var40 = (double)((float)(var46 - (par6 - 4)) / 3.0F);
var30 = var30 * (1.0D - var40) + -10.0D * var40;
}
par1ArrayOfDouble[var12] = var30;
++var12;
}
}
}
return par1ArrayOfDouble;
}
/**
* Checks to see if a chunk exists at x, y
*/
public boolean isChunkLoaded(int par1, int par2)
{
return true;
}
/**
* Populates chunk with ores etc etc
*/
public void getChunkAt(IChunkProvider par1IChunkProvider, int par2, int par3)
{
BlockSand.instaFall = true;
int var4 = par2 * 16;
int var5 = par3 * 16;
BiomeBase var6 = this.p.getBiome(var4 + 16, var5 + 16);
this.k.setSeed(this.p.getSeed());
long var7 = this.k.nextLong() / 2L * 2L + 1L;
long var9 = this.k.nextLong() / 2L * 2L + 1L;
this.k.setSeed((long)par2 * var7 + (long)par3 * var9 ^ this.p.getSeed());
boolean var11 = false;
//=====================================================================================================================
//removed village/stronghold/cave/ravine generations here
//=====================================================================================================================
int var12;
int var13;
int var14;
var6.a(this.p, this.k, var4, var5);
SpawnerCreature.a(this.p, var6, var4 + 8, var5 + 8, 16, 16, this.k);
var4 += 8;
var5 += 8;
for (var12 = 0; var12 < 16; ++var12)
{
for (var13 = 0; var13 < 16; ++var13)
{
var14 = this.p.h(var4 + var12, var5 + var13);
if (this.p.w(var12 + var4, var14 - 1, var13 + var5))
{
this.p.setTypeId(var12 + var4, var14 - 1, var13 + var5, Block.ICE.id);
}
if (this.p.y(var12 + var4, var14, var13 + var5))
{
this.p.setTypeId(var12 + var4, var14, var13 + var5, Block.SNOW.id);
}
}
}
BlockSand.instaFall = false;
}
/**
* Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks.
* Return true if all chunks have been saved.
*/
public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate)
{
return true;
}
/**
* Unloads the 100 oldest chunks from memory, due to a bug with chunkSet.add() never being called it thinks the list
* is always empty and will not remove any chunks.
*/
public boolean unloadChunks()
{
return false;
}
/**
* Returns if the IChunkProvider supports saving.
*/
public boolean canSave()
{
return true;
}
/**
* Converts the instance data to a readable string.
*/
public String getName()
{
return "RandomLevelSource";
}
/**
* Returns a list of creatures of the specified type that can spawn at the given location.
*/
public List getMobsFor(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4)
{
BiomeBase var5 = this.p.getBiome(par2, par4);
return var5 == null ? null : (var5 == BiomeBase.SWAMPLAND && par1EnumCreatureType == EnumCreatureType.MONSTER && this.x.a(par2, par3, par4) ? this.x.a() : var5.getMobs(par1EnumCreatureType));
}
/**
* Returns the location of the closest structure of the specified type. If not found returns null.
*/
public ChunkPosition findNearestMapFeature(World par1World, String par2Str, int par3, int par4, int par5)
{
return "Stronghold".equals(par2Str) && this.u != null ? this.u.getNearestGeneratedFeature(par1World, par3, par4, par5) : null;
}
public int getLoadedChunks()
{
return 0;
}
public void recreateStructures(int par1, int par2)
{
//=====================================================================================================================
//removed village/stronghold/cave/ravine generations here
//=====================================================================================================================
}
}
package net.minecraft.server.v1_4_6;
import java.util.Random;
public class BiomeDecorator
{
/** The world the BiomeDecorator is currently decorating */
protected World a;
/** The Biome Decorator's random number generator. */
protected Random b;
/** The X-coordinate of the chunk currently being decorated */
protected int c;
/** The Z-coordinate of the chunk currently being decorated */
protected int d;
/** The biome generator object. */
protected BiomeBase e;
/** The clay generator. */
protected WorldGenerator f = new WorldGenClay(4);
/** The sand generator. */
protected WorldGenerator g;
/** The gravel generator. */
protected WorldGenerator h;
/** The dirt generator. */
protected WorldGenerator i;
protected WorldGenerator j;
protected WorldGenerator k;
protected WorldGenerator l;
/** Field that holds gold WorldGenMinable */
protected WorldGenerator m;
/** Field that holds redstone WorldGenMinable */
protected WorldGenerator n;
/** Field that holds diamond WorldGenMinable */
protected WorldGenerator o;
/** Field that holds Lapis WorldGenMinable */
protected WorldGenerator p;
/** Field that holds one of the plantYellow WorldGenFlowers */
protected WorldGenerator q;
/** Field that holds one of the plantRed WorldGenFlowers */
protected WorldGenerator r;
/** Field that holds mushroomBrown WorldGenFlowers */
protected WorldGenerator s;
/** Field that holds mushroomRed WorldGenFlowers */
protected WorldGenerator t;
/** Field that holds big mushroom generator */
protected WorldGenerator u;
/** Field that holds WorldGenReed */
protected WorldGenerator v;
/** Field that holds WorldGenCactus */
protected WorldGenerator w;
/** The water lily generation! */
protected WorldGenerator x;
/** Amount of waterlilys per chunk. */
protected int y;
/**
* The number of trees to attempt to generate per chunk. Up to 10 in forests, none in deserts.
*/
protected int z;
/**
* The number of yellow flower patches to generate per chunk. The game generates much less than this number, since
* it attempts to generate them at a random altitude.
*/
protected int A;
/** The amount of tall grass to generate per chunk. */
protected int B;
/**
* The number of dead bushes to generate per chunk. Used in deserts and swamps.
*/
protected int C;
/**
* The number of extra mushroom patches per chunk. It generates 1/4 this number in brown mushroom patches, and 1/8
* this number in red mushroom patches. These mushrooms go beyond the default base number of mushrooms.
*/
protected int D;
/**
* The number of reeds to generate per chunk. Reeds won't generate if the randomly selected placement is unsuitable.
*/
protected int E;
/**
* The number of cactus plants to generate per chunk. Cacti only work on sand.
*/
protected int F;
/**
* The number of sand patches to generate per chunk. Sand patches only generate when part of it is underwater.
*/
protected int G;
/**
* The number of sand patches to generate per chunk. Sand patches only generate when part of it is underwater. There
* appear to be two separate fields for this.
*/
protected int H;
/**
* The number of clay patches to generate per chunk. Only generates when part of it is underwater.
*/
protected int I;
/** Amount of big mushrooms per chunk */
protected int J;
/** True if decorator should generate surface lava & water */
public boolean K;
public BiomeDecorator(BiomeBase par1BiomeGenBase)
{
this.g = new WorldGenSand(7, Block.SAND.id);
this.h = new WorldGenSand(6, Block.GRAVEL.id);
this.i = new WorldGenMinable(Block.DIRT.id, 32);
this.j = new WorldGenMinable(Block.GRAVEL.id, 32);
this.k = new WorldGenMinable(Block.COAL_ORE.id, 16);
this.l = new WorldGenMinable(Block.IRON_ORE.id, 8);
this.m = new WorldGenMinable(Block.GOLD_ORE.id, 8);
this.n = new WorldGenMinable(Block.REDSTONE_ORE.id, 7);
this.o = new WorldGenMinable(Block.DIAMOND_ORE.id, 7);
this.p = new WorldGenMinable(Block.LAPIS_ORE.id, 6);
this.q = new WorldGenFlowers(Block.YELLOW_FLOWER.id);
this.r = new WorldGenFlowers(Block.RED_ROSE.id);
this.s = new WorldGenFlowers(Block.BROWN_MUSHROOM.id);
this.t = new WorldGenFlowers(Block.RED_MUSHROOM.id);
this.u = new WorldGenHugeMushroom();
this.v = new WorldGenReed();
this.w = new WorldGenCactus();
this.x = new WorldGenWaterLily();
this.y = 0;
this.z = 0;
this.A = 2;
this.B = 1;
this.C = 0;
this.D = 0;
this.E = 0;
this.F = 0;
this.G = 1;
this.H = 3;
this.I = 1;
this.J = 0;
this.K = true;
this.e = par1BiomeGenBase;
}
/**
* Decorates the world. Calls code that was formerly (pre-1.8) in ChunkProviderGenerate.populate
*/
public void a(World par1World, Random par2Random, int par3, int par4)
{
if (this.a != null)
{
throw new RuntimeException("Already decorating!!");
}
else
{
this.a = par1World;
this.b = par2Random;
this.c = par3;
this.d = par4;
this.a();
this.a = null;
this.b = null;
}
}
/**
* The method that does the work of actually decorating chunks
*/
protected void a()
{
this.b();
int var1;
int var2;
int var3;
var1 = this.z;
if (this.b.nextInt(10) == 0)
{
++var1;
}
int var4;
for (var2 = 0; var2 < var1; ++var2)
{
var3 = this.c + this.b.nextInt(16) + 8;
var4 = this.d + this.b.nextInt(16) + 8;
WorldGenerator var5 = this.e.a(this.b);
var5.a(1.0D, 1.0D, 1.0D);
var5.a(this.a, this.b, var3, this.a.getHighestBlockYAt(var3, var4), var4);
}
int var7;
//=====================================================================================================================
//removed a tonne of code here that creates ores, tall grass, flowers, mushrooms reeds etc.
//=====================================================================================================================
for (var2 = 0; var2 < this.F; ++var2)
{
var3 = this.c + this.b.nextInt(16) + 8;
var4 = this.b.nextInt(128);
var7 = this.d + this.b.nextInt(16) + 8;
this.w.a(this.a, this.b, var3, var4, var7);
}
}
//=====================================================================================================================
//removed ore generators below
//=====================================================================================================================
/**
* Standard ore generation helper. Generates most ores.
*/
protected void genStandardOre1(int par1, WorldGenerator par2WorldGenerator, int par3, int par4)
{}
/**
* Standard ore generation helper. Generates Lapis Lazuli.
*/
protected void genStandardOre2(int par1, WorldGenerator par2WorldGenerator, int par3, int par4)
{}
/**
* Generates ores in the current chunk
*/
protected void b()
{}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment