diff options
author | Alkalus <draknyte1@hotmail.com> | 2017-07-13 09:18:41 +1000 |
---|---|---|
committer | Alkalus <draknyte1@hotmail.com> | 2017-07-13 09:18:41 +1000 |
commit | 27864fd0afce4fca6db97eb542c91abdaec9893e (patch) | |
tree | cb3aad87b0aef0fe839a93334567f268bc97c76e /src/Java | |
parent | 536aad631a6492b6b4da9df40c9cdfc5f6ad21ee (diff) | |
download | GT5-Unofficial-27864fd0afce4fca6db97eb542c91abdaec9893e.tar.gz GT5-Unofficial-27864fd0afce4fca6db97eb542c91abdaec9893e.tar.bz2 GT5-Unofficial-27864fd0afce4fca6db97eb542c91abdaec9893e.zip |
+ More WorldGen work.
Diffstat (limited to 'src/Java')
5 files changed, 609 insertions, 23 deletions
diff --git a/src/Java/gtPlusPlus/core/world/darkworld/biome/BiomeGenerator_Custom.java b/src/Java/gtPlusPlus/core/world/darkworld/biome/BiomeGenerator_Custom.java new file mode 100644 index 0000000000..2ac656a795 --- /dev/null +++ b/src/Java/gtPlusPlus/core/world/darkworld/biome/BiomeGenerator_Custom.java @@ -0,0 +1,426 @@ +package gtPlusPlus.core.world.darkworld.biome; + +import java.util.Random; + +import gtPlusPlus.core.world.darkworld.gen.WorldGenDeadLilly; +import net.minecraft.block.BlockFlower; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeDecorator; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenBigMushroom; +import net.minecraft.world.gen.feature.WorldGenCactus; +import net.minecraft.world.gen.feature.WorldGenClay; +import net.minecraft.world.gen.feature.WorldGenDeadBush; +import net.minecraft.world.gen.feature.WorldGenFlowers; +import net.minecraft.world.gen.feature.WorldGenLiquids; +import net.minecraft.world.gen.feature.WorldGenMinable; +import net.minecraft.world.gen.feature.WorldGenPumpkin; +import net.minecraft.world.gen.feature.WorldGenReed; +import net.minecraft.world.gen.feature.WorldGenSand; +import net.minecraft.world.gen.feature.WorldGenWaterlily; +import net.minecraft.world.gen.feature.WorldGenerator; + +import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.*; +import static net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.*; +import net.minecraftforge.common.*; +import net.minecraftforge.event.terraingen.*; + +public class BiomeGenerator_Custom extends BiomeDecorator { + /** The world the BiomeDecorator is currently decorating */ + public World currentWorld; + /** The Biome Decorator's random number generator. */ + public Random randomGenerator; + /** The X-coordinate of the chunk currently being decorated */ + public int chunk_X; + /** The Z-coordinate of the chunk currently being decorated */ + public int chunk_Z; + /** The clay generator. */ + public WorldGenerator clayGen = new WorldGenClay(4); + /** The sand generator. */ + public WorldGenerator sandGen; + /** The gravel generator. */ + public WorldGenerator gravelAsSandGen; + /** The dirt generator. */ + public WorldGenerator dirtGen; + public WorldGenerator gravelGen; + public WorldGenerator coalGen; + public WorldGenerator ironGen; + /** Field that holds gold WorldGenMinable */ + public WorldGenerator goldGen; + /** Field that holds redstone WorldGenMinable */ + public WorldGenerator redstoneGen; + /** Field that holds diamond WorldGenMinable */ + public WorldGenerator diamondGen; + /** Field that holds Lapis WorldGenMinable */ + public WorldGenerator lapisGen; + public WorldGenFlowers yellowFlowerGen; + /** Field that holds mushroomBrown WorldGenFlowers */ + public WorldGenerator mushroomBrownGen; + /** Field that holds mushroomRed WorldGenFlowers */ + public WorldGenerator mushroomRedGen; + /** Field that holds big mushroom generator */ + public WorldGenerator bigMushroomGen; + /** Field that holds WorldGenReed */ + public WorldGenerator reedGen; + /** Field that holds WorldGenCactus */ + public WorldGenerator cactusGen; + /** The water lily generation! */ + public WorldGenerator waterlilyGen; + /** Amount of waterlilys per chunk. */ + public int waterlilyPerChunk; + /** The number of trees to attempt to generate per chunk. Up to 10 in forests, none in deserts. */ + public int treesPerChunk; + /** + * 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. + */ + public int flowersPerChunk; + /** The amount of tall grass to generate per chunk. */ + public int grassPerChunk; + /** The number of dead bushes to generate per chunk. Used in deserts and swamps. */ + public int deadBushPerChunk; + /** + * 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. + */ + public int mushroomsPerChunk; + /** The number of reeds to generate per chunk. Reeds won't generate if the randomly selected placement is unsuitable. */ + public int reedsPerChunk; + /** The number of cactus plants to generate per chunk. Cacti only work on sand. */ + public int cactiPerChunk; + /** The number of sand patches to generate per chunk. Sand patches only generate when part of it is underwater. */ + public int sandPerChunk; + /** + * 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. + */ + public int sandPerChunk2; + /** The number of clay patches to generate per chunk. Only generates when part of it is underwater. */ + public int clayPerChunk; + /** Amount of big mushrooms per chunk */ + public int bigMushroomsPerChunk; + /** True if decorator should generate surface lava & water */ + public boolean generateLakes; + + public BiomeGenerator_Custom(){ + //Basic Blocks + this.sandGen = new WorldGenSand(Blocks.sand, 12); + this.gravelAsSandGen = new WorldGenSand(Blocks.gravel, 8); + this.dirtGen = new WorldGenMinable(Blocks.dirt, 32); + this.gravelGen = new WorldGenMinable(Blocks.gravel, 12); + + + //Oregen + this.coalGen = new WorldGenMinable(Blocks.coal_ore, 16); + this.ironGen = new WorldGenMinable(Blocks.iron_ore, 12); + this.goldGen = new WorldGenMinable(Blocks.gold_ore, 12); + this.redstoneGen = new WorldGenMinable(Blocks.redstone_ore, 10); + this.diamondGen = new WorldGenMinable(Blocks.diamond_ore, 12); + this.lapisGen = new WorldGenMinable(Blocks.lapis_ore, 8); + + //Nature + /*this.yellowFlowerGen = new WorldGenFlowers(Blocks.yellow_flower); + this.mushroomBrownGen = new WorldGenFlowers(Blocks.brown_mushroom); + this.mushroomRedGen = new WorldGenFlowers(Blocks.red_mushroom); + this.bigMushroomGen = new WorldGenBigMushroom();*/ + this.reedGen = new WorldGenReed(); + this.cactusGen = new WorldGenCactus(); + this.waterlilyGen = new WorldGenDeadLilly(); + + this.flowersPerChunk = 2; + this.grassPerChunk = 5; + this.sandPerChunk = 3; + this.sandPerChunk2 = 5; + this.clayPerChunk = 7; + + this.generateLakes = true; + } + + public void decorateChunk(World p_150512_1_, Random p_150512_2_, BiomeGenBase p_150512_3_, int p_150512_4_, int p_150512_5_) + { + if (this.currentWorld != null) + { + throw new RuntimeException("Already decorating!!"); + } + else + { + this.currentWorld = p_150512_1_; + this.randomGenerator = p_150512_2_; + this.chunk_X = p_150512_4_; + this.chunk_Z = p_150512_5_; + this.genDecorations(p_150512_3_); + this.currentWorld = null; + this.randomGenerator = null; + } + } + + protected void genDecorations(BiomeGenBase p_150513_1_) + { + MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(currentWorld, randomGenerator, chunk_X, chunk_Z)); + this.generateOres(); + int i; + int j; + int k; + + boolean doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, SAND); + for (i = 0; doGen && i < this.sandPerChunk2; ++i) + { + j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + this.sandGen.generate(this.currentWorld, this.randomGenerator, j, this.currentWorld.getTopSolidOrLiquidBlock(j, k), k); + } + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, CLAY); + for (i = 0; doGen && i < this.clayPerChunk; ++i) + { + j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + this.clayGen.generate(this.currentWorld, this.randomGenerator, j, this.currentWorld.getTopSolidOrLiquidBlock(j, k), k); + } + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, SAND_PASS2); + for (i = 0; doGen && i < this.sandPerChunk; ++i) + { + j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + this.gravelAsSandGen.generate(this.currentWorld, this.randomGenerator, j, this.currentWorld.getTopSolidOrLiquidBlock(j, k), k); + } + + i = this.treesPerChunk; + + if (this.randomGenerator.nextInt(10) == 0) + { + ++i; + } + + int l; + int i1; + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, TREE); + for (j = 0; doGen && j < i; ++j) + { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + i1 = this.currentWorld.getHeightValue(k, l); + WorldGenAbstractTree worldgenabstracttree = p_150513_1_.func_150567_a(this.randomGenerator); + worldgenabstracttree.setScale(1.0D, 1.0D, 1.0D); + + if (worldgenabstracttree.generate(this.currentWorld, this.randomGenerator, k, i1, l)) + { + worldgenabstracttree.func_150524_b(this.currentWorld, this.randomGenerator, k, i1, l); + } + } + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, BIG_SHROOM); + for (j = 0; doGen && j < this.bigMushroomsPerChunk; ++j) + { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + this.bigMushroomGen.generate(this.currentWorld, this.randomGenerator, k, this.currentWorld.getHeightValue(k, l), l); + } + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, FLOWERS); + for (j = 0; doGen && j < this.flowersPerChunk; ++j) + { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + i1 = nextInt(this.currentWorld.getHeightValue(k, l) + 32); + String s = p_150513_1_.func_150572_a(this.randomGenerator, k, i1, l); + BlockFlower blockflower = BlockFlower.func_149857_e(s); + + if (blockflower.getMaterial() != Material.air) + { + this.yellowFlowerGen.func_150550_a(blockflower, BlockFlower.func_149856_f(s)); + this.yellowFlowerGen.generate(this.currentWorld, this.randomGenerator, k, i1, l); + } + } + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, GRASS); + for (j = 0; doGen && j < this.grassPerChunk; ++j) + { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + i1 = nextInt(this.currentWorld.getHeightValue(k, l) * 2); + WorldGenerator worldgenerator = p_150513_1_.getRandomWorldGenForGrass(this.randomGenerator); + worldgenerator.generate(this.currentWorld, this.randomGenerator, k, i1, l); + } + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, DEAD_BUSH); + for (j = 0; doGen && j < this.deadBushPerChunk; ++j) + { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + i1 = nextInt(this.currentWorld.getHeightValue(k, l) * 2); + (new WorldGenDeadBush(Blocks.deadbush)).generate(this.currentWorld, this.randomGenerator, k, i1, l); + } + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, LILYPAD); + for (j = 0; doGen && j < this.waterlilyPerChunk; ++j) + { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + + for (i1 = nextInt(this.currentWorld.getHeightValue(k, l) * 2); i1 > 0 && this.currentWorld.isAirBlock(k, i1 - 1, l); --i1) + { + ; + } + + this.waterlilyGen.generate(this.currentWorld, this.randomGenerator, k, i1, l); + } + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, SHROOM); + for (j = 0; doGen && j < this.mushroomsPerChunk; ++j) + { + if (this.randomGenerator.nextInt(4) == 0) + { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + i1 = this.currentWorld.getHeightValue(k, l); + this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, k, i1, l); + } + + if (this.randomGenerator.nextInt(8) == 0) + { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + i1 = nextInt(this.currentWorld.getHeightValue(k, l) * 2); + this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, k, i1, l); + } + } + + if (doGen && this.randomGenerator.nextInt(4) == 0) + { + j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + l = nextInt(this.currentWorld.getHeightValue(j, k) * 2); + this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, j, l, k); + } + + if (doGen && this.randomGenerator.nextInt(8) == 0) + { + j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + l = nextInt(this.currentWorld.getHeightValue(j, k) * 2); + this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, j, l, k); + } + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, REED); + for (j = 0; doGen && j < this.reedsPerChunk; ++j) + { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + i1 = nextInt(this.currentWorld.getHeightValue(k, l) * 2); + this.reedGen.generate(this.currentWorld, this.randomGenerator, k, i1, l); + } + + for (j = 0; doGen && j < 10; ++j) + { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + i1 = nextInt(this.currentWorld.getHeightValue(k, l) * 2); + this.reedGen.generate(this.currentWorld, this.randomGenerator, k, i1, l); + } + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, PUMPKIN); + if (doGen && this.randomGenerator.nextInt(32) == 0) + { + j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + l = nextInt(this.currentWorld.getHeightValue(j, k) * 2); + (new WorldGenPumpkin()).generate(this.currentWorld, this.randomGenerator, j, l, k); + } + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, CACTUS); + for (j = 0; doGen && j < this.cactiPerChunk; ++j) + { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + i1 = nextInt(this.currentWorld.getHeightValue(k, l) * 2); + this.cactusGen.generate(this.currentWorld, this.randomGenerator, k, i1, l); + } + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, LAKE); + if (doGen && this.generateLakes) + { + for (j = 0; j < 50; ++j) + { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.randomGenerator.nextInt(this.randomGenerator.nextInt(248) + 8); + i1 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + (new WorldGenLiquids(Blocks.flowing_water)).generate(this.currentWorld, this.randomGenerator, k, l, i1); + } + + for (j = 0; j < 20; ++j) + { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.randomGenerator.nextInt(this.randomGenerator.nextInt(this.randomGenerator.nextInt(240) + 8) + 8); + i1 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + (new WorldGenLiquids(Blocks.flowing_lava)).generate(this.currentWorld, this.randomGenerator, k, l, i1); + } + } + + MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(currentWorld, randomGenerator, chunk_X, chunk_Z)); + } + + /** + * Standard ore generation helper. Generates most ores. + */ + protected void genStandardOre1(int p_76795_1_, WorldGenerator p_76795_2_, int p_76795_3_, int p_76795_4_) + { + for (int l = 0; l < p_76795_1_; ++l) + { + int i1 = this.chunk_X + this.randomGenerator.nextInt(16); + int j1 = this.randomGenerator.nextInt(p_76795_4_ - p_76795_3_) + p_76795_3_; + int k1 = this.chunk_Z + this.randomGenerator.nextInt(16); + p_76795_2_.generate(this.currentWorld, this.randomGenerator, i1, j1, k1); + } + } + + /** + * Standard ore generation helper. Generates Lapis Lazuli. + */ + protected void genStandardOre2(int p_76793_1_, WorldGenerator p_76793_2_, int p_76793_3_, int p_76793_4_) + { + for (int l = 0; l < p_76793_1_; ++l) + { + int i1 = this.chunk_X + this.randomGenerator.nextInt(16); + int j1 = this.randomGenerator.nextInt(p_76793_4_) + this.randomGenerator.nextInt(p_76793_4_) + (p_76793_3_ - p_76793_4_); + int k1 = this.chunk_Z + this.randomGenerator.nextInt(16); + p_76793_2_.generate(this.currentWorld, this.randomGenerator, i1, j1, k1); + } + } + + /** + * Generates ores in the current chunk + */ + protected void generateOres() + { + MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Pre(currentWorld, randomGenerator, chunk_X, chunk_Z)); + if (TerrainGen.generateOre(currentWorld, randomGenerator, dirtGen, chunk_X, chunk_Z, DIRT)) + this.genStandardOre1(20, this.dirtGen, 0, 256); + if (TerrainGen.generateOre(currentWorld, randomGenerator, gravelGen, chunk_X, chunk_Z, GRAVEL)) + this.genStandardOre1(10, this.gravelGen, 0, 256); + if (TerrainGen.generateOre(currentWorld, randomGenerator, coalGen, chunk_X, chunk_Z, COAL)) + this.genStandardOre1(20, this.coalGen, 0, 128); + if (TerrainGen.generateOre(currentWorld, randomGenerator, ironGen, chunk_X, chunk_Z, IRON)) + this.genStandardOre1(20, this.ironGen, 0, 64); + if (TerrainGen.generateOre(currentWorld, randomGenerator, goldGen, chunk_X, chunk_Z, GOLD)) + this.genStandardOre1(2, this.goldGen, 0, 32); + if (TerrainGen.generateOre(currentWorld, randomGenerator, redstoneGen, chunk_X, chunk_Z, REDSTONE)) + this.genStandardOre1(8, this.redstoneGen, 0, 16); + if (TerrainGen.generateOre(currentWorld, randomGenerator, diamondGen, chunk_X, chunk_Z, DIAMOND)) + this.genStandardOre1(1, this.diamondGen, 0, 16); + if (TerrainGen.generateOre(currentWorld, randomGenerator, lapisGen, chunk_X, chunk_Z, LAPIS)) + this.genStandardOre2(1, this.lapisGen, 16, 16); + MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Post(currentWorld, randomGenerator, chunk_X, chunk_Z)); + } + + private int nextInt(int i) { + if (i <= 1) + return 0; + return this.randomGenerator.nextInt(i); + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/world/darkworld/biome/Biome_DarkWorld.java b/src/Java/gtPlusPlus/core/world/darkworld/biome/Biome_DarkWorld.java index d3629ff139..3eadb6116e 100644 --- a/src/Java/gtPlusPlus/core/world/darkworld/biome/Biome_DarkWorld.java +++ b/src/Java/gtPlusPlus/core/world/darkworld/biome/Biome_DarkWorld.java @@ -56,25 +56,16 @@ public class Biome_DarkWorld { @SuppressWarnings("unchecked") public BiomeGenbiomeDarkWorld() { super(CORE.DARKBIOME_ID); + this.theBiomeDecorator = new BiomeGenerator_Custom(); Utils.LOG_INFO("Dark World Temperature Category: "+getTempCategory()); this.setBiomeName("Dark World"); this.topBlock = Dimension_DarkWorld.blockTopLayer; this.fillerBlock = Dimension_DarkWorld.blockSecondLayer; - this.theBiomeDecorator.generateLakes = true; - this.theBiomeDecorator.treesPerChunk = 35; - this.theBiomeDecorator.flowersPerChunk = 4; - this.theBiomeDecorator.grassPerChunk = 15; - this.theBiomeDecorator.deadBushPerChunk = 15; - this.theBiomeDecorator.mushroomsPerChunk = 2; - this.theBiomeDecorator.reedsPerChunk = 1; - this.theBiomeDecorator.cactiPerChunk = 1; - this.theBiomeDecorator.sandPerChunk = 8; - this.theBiomeDecorator.clayPerChunk = 12; - this.theBiomeDecorator.waterlilyPerChunk = 10; this.enableRain = true; this.enableSnow = false; this.rainfall = 0.7F; - this.setHeight(new BiomeGenBase.Height(0.35F, 0.65F)); + this.setHeight(new BiomeGenBase.Height(0.3F, 0.5F)); + this.heightVariation = 0.4F; this.waterColorMultiplier = 0x17290A; this.rootHeight = -0.25f; //Ground level @@ -84,22 +75,22 @@ public class Biome_DarkWorld { this.spawnableCaveCreatureList.clear(); //Enemies - this.spawnableMonsterList.add(new SpawnListEntry(EntityBlaze.class, 5, 1, 5)); - this.spawnableMonsterList.add(new SpawnListEntry(EntityCaveSpider.class, 5, 1, 5)); - this.spawnableMonsterList.add(new SpawnListEntry(EntityCreeper.class, 4, 1, 2)); - this.spawnableMonsterList.add(new SpawnListEntry(EntityEnderman.class, 5, 1, 5)); this.spawnableMonsterList.add(new SpawnListEntry(EntityGhast.class, 5, 1, 5)); this.spawnableMonsterList.add(new SpawnListEntry(EntityGiantZombie.class, 20, 1, 1)); - this.spawnableMonsterList.add(new SpawnListEntry(EntityMagmaCube.class, 5, 1, 5)); - this.spawnableMonsterList.add(new SpawnListEntry(EntityPigZombie.class, 5, 1, 5)); - this.spawnableMonsterList.add(new SpawnListEntry(EntitySkeleton.class, 5, 1, 5)); - this.spawnableMonsterList.add(new SpawnListEntry(EntitySpider.class, 5, 1, 5)); - this.spawnableMonsterList.add(new SpawnListEntry(EntityWolf.class, 5, 4, 10)); - this.spawnableMonsterList.add(new SpawnListEntry(EntityZombie.class, 5, 1, 5)); + addToMonsterSpawnLists(EntityBlaze.class, 5, 1, 5); + addToMonsterSpawnLists(EntityCaveSpider.class, 5, 1, 5); + addToMonsterSpawnLists(EntityCreeper.class, 4, 1, 2); + addToMonsterSpawnLists(EntityEnderman.class, 5, 1, 5); + addToMonsterSpawnLists(EntityMagmaCube.class, 5, 1, 5); + addToMonsterSpawnLists(EntityPigZombie.class, 5, 1, 5); + addToMonsterSpawnLists(EntitySkeleton.class, 5, 1, 5); + addToMonsterSpawnLists(EntitySpider.class, 5, 1, 5); + addToMonsterSpawnLists(EntityZombie.class, 5, 1, 5); //Passive this.spawnableCreatureList.add(new SpawnListEntry(EntityCow.class, 5, 5, 10)); this.spawnableCreatureList.add(new SpawnListEntry(EntityBat.class, 4, 4, 8)); + this.spawnableCreatureList.add(new SpawnListEntry(EntityWolf.class, 5, 4, 10)); //Water this.spawnableWaterCreatureList.add(new SpawnListEntry(EntitySquid.class, 5, 1, 10)); @@ -119,7 +110,13 @@ public class Biome_DarkWorld { @Override @SideOnly(Side.CLIENT) public int getSkyColorByTemp(float par1) { - return 0x333333; + return 0xF67A14; + } + + private boolean addToMonsterSpawnLists(Class EntityClass, int a, int b, int c){ + this.spawnableMonsterList.add(new SpawnListEntry(EntityClass, a, b, c)); + this.spawnableCaveCreatureList.add(new SpawnListEntry(EntityClass, a, b, c)); + return true; } } diff --git a/src/Java/gtPlusPlus/core/world/darkworld/block/blockDarkWorldPollutedDirt.java b/src/Java/gtPlusPlus/core/world/darkworld/block/blockDarkWorldPollutedDirt.java index f95e9a7fb9..2168677d56 100644 --- a/src/Java/gtPlusPlus/core/world/darkworld/block/blockDarkWorldPollutedDirt.java +++ b/src/Java/gtPlusPlus/core/world/darkworld/block/blockDarkWorldPollutedDirt.java @@ -1,9 +1,13 @@ package gtPlusPlus.core.world.darkworld.block; import cpw.mods.fml.common.registry.LanguageRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.creative.AddToCreativeTab; import net.minecraft.block.BlockDirt; import net.minecraft.block.BlockGrass; +import net.minecraft.world.ColorizerGrass; +import net.minecraft.world.IBlockAccess; public class blockDarkWorldPollutedDirt extends BlockDirt { @@ -15,4 +19,46 @@ public class blockDarkWorldPollutedDirt extends BlockDirt { LanguageRegistry.addName(this, "Polluted Soil"); } + @SideOnly(Side.CLIENT) + public int getBlockColor() + { + double d0 = 0.5D; + double d1 = 1.0D; + return ColorizerGrass.getGrassColor(d0, d1); + } + + /** + * Returns the color this block should be rendered. Used by leaves. + */ + @SideOnly(Side.CLIENT) + public int getRenderColor(int p_149741_1_) + { + return this.getBlockColor(); + } + + /** + * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called + * when first determining what to render. + */ + @SideOnly(Side.CLIENT) + public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, int p_149720_3_, int p_149720_4_) + { + int l = 0; + int i1 = 0; + int j1 = 0; + + for (int k1 = -1; k1 <= 1; ++k1) + { + for (int l1 = -1; l1 <= 1; ++l1) + { + int i2 = p_149720_1_.getBiomeGenForCoords(p_149720_2_ + l1, p_149720_4_ + k1).getBiomeGrassColor(p_149720_2_ + l1, p_149720_3_, p_149720_4_ + k1); + l += (i2 & 16711680) >> 16; + i1 += (i2 & 65280) >> 8; + j1 += i2 & 255; + } + } + + return (l / 9 & 255) << 16 | (i1 / 9 & 255) << 8 | j1 / 9 & 255; + } + } diff --git a/src/Java/gtPlusPlus/core/world/darkworld/gen/WorldGenDeadLilly.java b/src/Java/gtPlusPlus/core/world/darkworld/gen/WorldGenDeadLilly.java new file mode 100644 index 0000000000..292eff3289 --- /dev/null +++ b/src/Java/gtPlusPlus/core/world/darkworld/gen/WorldGenDeadLilly.java @@ -0,0 +1,26 @@ +package gtPlusPlus.core.world.darkworld.gen; + +import java.util.Random; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenWaterlily; + +public class WorldGenDeadLilly extends WorldGenWaterlily { + + public boolean generate(World world, Random rand, int x, int y, int z) + { + for (int l = 0; l < 10; ++l) + { + int i1 = x + rand.nextInt(8) - rand.nextInt(8); + int j1 = y + rand.nextInt(4) - rand.nextInt(4); + int k1 = z + rand.nextInt(8) - rand.nextInt(8); + + if (world.isAirBlock(i1, j1, k1) && Blocks.waterlily.canPlaceBlockAt(world, i1, j1, k1)) + { + world.setBlock(i1, j1, k1, Blocks.waterlily, 0, 2); + } + } + + return true; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/world/darkworld/gen/WorldGenMinable_Custom.java b/src/Java/gtPlusPlus/core/world/darkworld/gen/WorldGenMinable_Custom.java new file mode 100644 index 0000000000..4dc033214f --- /dev/null +++ b/src/Java/gtPlusPlus/core/world/darkworld/gen/WorldGenMinable_Custom.java @@ -0,0 +1,91 @@ +package gtPlusPlus.core.world.darkworld.gen; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenMinable; + +public class WorldGenMinable_Custom extends WorldGenMinable +{ + /** The block to generate. */ + private Block oreToGenerate; + /** The number of blocks to generate. */ + private int numberOfBlocks; + /** The block to replace. */ + private Block blockToReplace; + /** The meta of the block. */ + private int mineableBlockMeta; + + public WorldGenMinable_Custom(Block block, int count){ + super(block, count, Blocks.stone); + } + + public WorldGenMinable_Custom(Block block, int count, Block target){ + super(block, count, target); + this.oreToGenerate = block; + this.numberOfBlocks = count; + this.blockToReplace = target; + } + + public WorldGenMinable_Custom(Block block, int meta, int number, Block target){ + this(block, number, target); + this.mineableBlockMeta = meta; + } + + public boolean generate(World world, Random rand, int x, int y, int z) + { + float f = rand.nextFloat() * (float)Math.PI; + double d0 = (double)((float)(x + 16) + MathHelper.sin(f) * (float)this.numberOfBlocks / 4.0F); + double d1 = (double)((float)(x + 16) - MathHelper.sin(f) * (float)this.numberOfBlocks / 4.0F); + double d2 = (double)((float)(z + 16) + MathHelper.cos(f) * (float)this.numberOfBlocks / 4.0F); + double d3 = (double)((float)(z + 16) - MathHelper.cos(f) * (float)this.numberOfBlocks / 4.0F); + double d4 = (double)(y + rand.nextInt(5) - 2); + double d5 = (double)(y + rand.nextInt(5) - 2); + + for (int l = 0; l <= this.numberOfBlocks; ++l) + { + double d6 = d0 + (d1 - d0) * (double)l / (double)this.numberOfBlocks; + double d7 = d4 + (d5 - d4) * (double)l / (double)this.numberOfBlocks; + double d8 = d2 + (d3 - d2) * (double)l / (double)this.numberOfBlocks; + double d9 = rand.nextDouble() * (double)this.numberOfBlocks / 8.0D; + double d10 = (double)(MathHelper.sin((float)l * (float)Math.PI / (float)this.numberOfBlocks) + 1.0F) * d9 + 1.0D; + double d11 = (double)(MathHelper.sin((float)l * (float)Math.PI / (float)this.numberOfBlocks) + 1.0F) * d9 + 1.0D; + int i1 = MathHelper.floor_double(d6 - d10 / 2.0D); + int j1 = MathHelper.floor_double(d7 - d11 / 2.0D); + int k1 = MathHelper.floor_double(d8 - d10 / 2.0D); + int l1 = MathHelper.floor_double(d6 + d10 / 2.0D); + int i2 = MathHelper.floor_double(d7 + d11 / 2.0D); + int j2 = MathHelper.floor_double(d8 + d10 / 2.0D); + + for (int k2 = i1; k2 <= l1; ++k2) + { + double d12 = ((double)k2 + 0.5D - d6) / (d10 / 2.0D); + + if (d12 * d12 < 1.0D) + { + for (int l2 = j1; l2 <= i2; ++l2) + { + double d13 = ((double)l2 + 0.5D - d7) / (d11 / 2.0D); + + if (d12 * d12 + d13 * d13 < 1.0D) + { + for (int i3 = k1; i3 <= j2; ++i3) + { + double d14 = ((double)i3 + 0.5D - d8) / (d10 / 2.0D); + + if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && world.getBlock(k2, l2, i3).isReplaceableOreGen(world, k2, l2, i3, blockToReplace)) + { + world.setBlock(k2, l2, i3, this.oreToGenerate, mineableBlockMeta, 2); + } + } + } + } + } + } + } + + return true; + } +}
\ No newline at end of file |