diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-07-10 00:10:07 +1000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-07-10 00:10:07 +1000 |
commit | f0469060c2a6d805ce1ec2cef8ad1ecd2f0adb0a (patch) | |
tree | faeecf8531c0fa20cfc09d745fe668dc1da55e23 /src/Java/gtPlusPlus/australia | |
parent | 99f1a6d6a294a3adb79904c3f228e14bc9a23215 (diff) | |
download | GT5-Unofficial-f0469060c2a6d805ce1ec2cef8ad1ecd2f0adb0a.tar.gz GT5-Unofficial-f0469060c2a6d805ce1ec2cef8ad1ecd2f0adb0a.tar.bz2 GT5-Unofficial-f0469060c2a6d805ce1ec2cef8ad1ecd2f0adb0a.zip |
+ Added a Custom ore Generator based on vanilla to Australia.
+ Added some custom trees and further tweaked the Australian Biomes.
$ Fixed a bug with the CustomDecorator that allowed multiple chunks to decorate at once. (I hope.)
Diffstat (limited to 'src/Java/gtPlusPlus/australia')
12 files changed, 899 insertions, 254 deletions
diff --git a/src/Java/gtPlusPlus/australia/biome/CustomDecorator.java b/src/Java/gtPlusPlus/australia/biome/CustomDecorator.java new file mode 100644 index 0000000000..fcf83898d9 --- /dev/null +++ b/src/Java/gtPlusPlus/australia/biome/CustomDecorator.java @@ -0,0 +1,318 @@ +package gtPlusPlus.australia.biome; + +import java.util.Random; + +import gtPlusPlus.australia.gen.world.WorldGenAustralianOre; +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.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 CustomDecorator extends BiomeDecorator { + + + public CustomDecorator() { + this.sandGen = new WorldGenSand(Blocks.sand, 10); + this.gravelAsSandGen = new WorldGenSand(Blocks.gravel, 6); + this.dirtGen = new WorldGenMinable(Blocks.dirt, 16); + this.gravelGen = new WorldGenMinable(Blocks.gravel, 16); + + this.coalGen = new WorldGenAustralianOre(Blocks.coal_ore, 4); + this.ironGen = new WorldGenAustralianOre(Blocks.clay, 4); + this.goldGen = new WorldGenAustralianOre(Blocks.soul_sand, 20); + this.redstoneGen = new WorldGenAustralianOre(Blocks.bedrock, 8); + this.diamondGen = new WorldGenAustralianOre(Blocks.diamond_ore, 1); + this.lapisGen = new WorldGenAustralianOre(Blocks.lava, 16); + + 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 WorldGenWaterlily(); + this.flowersPerChunk = 2; + this.grassPerChunk = 1; + this.sandPerChunk = 1; + this.sandPerChunk2 = 3; + this.clayPerChunk = 2; + 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 aAmount, WorldGenerator aOreGenerator, int p_76795_3_, int p_76795_4_) { + for (int l = 0; l < aAmount; ++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); + aOreGenerator.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(10, this.ironGen, 0, 64); + if (TerrainGen.generateOre(currentWorld, randomGenerator, goldGen, chunk_X, chunk_Z, GOLD)) + this.genStandardOre1(15, this.goldGen, 0, 32); + if (TerrainGen.generateOre(currentWorld, randomGenerator, redstoneGen, chunk_X, chunk_Z, REDSTONE)) + this.genStandardOre1(10, 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(10, 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/australia/biome/GenLayerBiomesAustraliaDimension.java b/src/Java/gtPlusPlus/australia/biome/GenLayerBiomesAustraliaDimension.java index 56d5291823..571ae636e0 100644 --- a/src/Java/gtPlusPlus/australia/biome/GenLayerBiomesAustraliaDimension.java +++ b/src/Java/gtPlusPlus/australia/biome/GenLayerBiomesAustraliaDimension.java @@ -1,7 +1,5 @@ package gtPlusPlus.australia.biome; -import gtPlusPlus.australia.biome.type.Biome_AustralianDesert; -import gtPlusPlus.australia.biome.type.Biome_AustralianDesert2; import gtPlusPlus.australia.biome.type.Biome_AustralianDesert_Ex; import gtPlusPlus.australia.biome.type.Biome_AustralianForest; import gtPlusPlus.australia.biome.type.Biome_AustralianOcean; @@ -14,13 +12,15 @@ import net.minecraft.world.gen.layer.IntCache; public class GenLayerBiomesAustraliaDimension extends GenLayer { protected BiomeGenBase[] allowedBiomes = { - /*Biome_AustralianDesert.biome, - Biome_AustralianDesert2.biome,*/ Biome_AustralianDesert_Ex.biome, - Biome_AustralianOcean.biome, + Biome_AustralianDesert_Ex.biome, + Biome_AustralianOutback.biome, + Biome_AustralianOutback.biome, + Biome_AustralianForest.biome, Biome_AustralianForest.biome, Biome_AustralianPlains.biome, - Biome_AustralianOutback.biome + Biome_AustralianPlains.biome, + Biome_AustralianOcean.biome, }; public GenLayerBiomesAustraliaDimension(long seed) { diff --git a/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianDesert_Ex.java b/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianDesert_Ex.java index 3fd15e130a..2b6ae6bd71 100644 --- a/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianDesert_Ex.java +++ b/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianDesert_Ex.java @@ -2,9 +2,11 @@ package gtPlusPlus.australia.biome.type; import java.util.Random; +import gtPlusPlus.australia.biome.CustomDecorator; import gtPlusPlus.core.lib.CORE; import net.minecraft.init.Blocks; import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.biome.BiomeGenDesert; import net.minecraft.world.gen.feature.WorldGenDesertWells; import net.minecraftforge.common.BiomeDictionary; @@ -21,7 +23,7 @@ public class Biome_AustralianDesert_Ex extends BiomeGenDesert { this.theBiomeDecorator.treesPerChunk = -999; this.theBiomeDecorator.deadBushPerChunk = 2; this.theBiomeDecorator.reedsPerChunk = 50; - this.theBiomeDecorator.cactiPerChunk = 10; + this.theBiomeDecorator.cactiPerChunk = 100; this.setColor(16421912); this.setBiomeName("Australian Desert III"); this.setDisableRain(); @@ -43,7 +45,7 @@ public class Biome_AustralianDesert_Ex extends BiomeGenDesert { { super.decorate(p_76728_1_, p_76728_2_, p_76728_3_, p_76728_4_); - if (p_76728_2_.nextInt(1000) == 0) + if (p_76728_2_.nextInt(850) == 0) { int k = p_76728_3_ + p_76728_2_.nextInt(16) + 8; int l = p_76728_4_ + p_76728_2_.nextInt(16) + 8; @@ -51,4 +53,13 @@ public class Biome_AustralianDesert_Ex extends BiomeGenDesert { worldgendesertwells.generate(p_76728_1_, p_76728_2_, k, p_76728_1_.getHeightValue(k, l) + 1, l); } } + + /** + * Allocate a new BiomeDecorator for this BiomeGenBase + */ + @Override + public BiomeDecorator createBiomeDecorator() + { + return getModdedBiomeDecorator(new CustomDecorator()); + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianForest.java b/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianForest.java index 29fd27bed6..c00fd5edef 100644 --- a/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianForest.java +++ b/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianForest.java @@ -2,17 +2,19 @@ package gtPlusPlus.australia.biome.type; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.australia.biome.CustomDecorator; +import gtPlusPlus.australia.gen.world.WorldGenAustralianTrees; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.math.MathUtils; import java.util.Random; import net.minecraft.block.BlockFlower; import net.minecraft.entity.passive.EntityWolf; -import net.minecraft.init.Blocks; import net.minecraft.util.MathHelper; import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenForest; -import net.minecraft.world.biome.BiomeGenMutated; import net.minecraft.world.gen.feature.WorldGenAbstractTree; import net.minecraft.world.gen.feature.WorldGenBigMushroom; import net.minecraft.world.gen.feature.WorldGenCanopyTree; @@ -21,205 +23,176 @@ import net.minecraftforge.common.BiomeDictionary; import net.minecraftforge.common.BiomeManager; public class Biome_AustralianForest extends BiomeGenForest { - - private int field_150632_aF; - protected static final WorldGenForest field_150629_aC = new WorldGenForest(false, true); - protected static final WorldGenForest field_150630_aD = new WorldGenForest(false, false); - protected static final WorldGenCanopyTree field_150631_aE = new WorldGenCanopyTree(false); + private int mWoodMeta; + protected static final WorldGenForest mGenTreeForest = new WorldGenForest(false, true); + protected static final WorldGenForest mGenTreeForest2 = new WorldGenForest(false, false); + protected static final WorldGenCanopyTree mGenTreeCanopy = new WorldGenCanopyTree(false); + protected static final WorldGenAustralianTrees mGenTreeAustralian = new WorldGenAustralianTrees(true); public static Biome_AustralianForest biome = new Biome_AustralianForest(CORE.AUSTRALIA_BIOME_FOREST_ID, 2); + public void load() { BiomeDictionary.registerBiomeType(biome, BiomeDictionary.Type.FOREST); BiomeManager.addSpawnBiome(biome); } - - public Biome_AustralianForest(int p_i45377_1_, int p_i45377_2_){ - super(p_i45377_1_, p_i45377_2_); - this.field_150632_aF = p_i45377_2_; - this.setColor(353825); - this.setBiomeName("Australian Forest"); - this.theBiomeDecorator.treesPerChunk = 10; - this.theBiomeDecorator.grassPerChunk = 2; - - if (this.field_150632_aF == 1) - { - this.theBiomeDecorator.treesPerChunk = 6; - this.theBiomeDecorator.flowersPerChunk = 100; - this.theBiomeDecorator.grassPerChunk = 1; - } - - this.func_76733_a(5159473); - this.setTemperatureRainfall(0.7F, 0.8F); - - if (this.field_150632_aF == 2) - { - this.field_150609_ah = 353825; - this.color = 3175492; - this.setTemperatureRainfall(0.6F, 0.6F); - } - - if (this.field_150632_aF == 0) - { - this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityWolf.class, 5, 4, 4)); - } - - if (this.field_150632_aF == 3) - { - this.theBiomeDecorator.treesPerChunk = -999; - } - - if (this.field_150632_aF == 1) - { - this.flowers.clear(); - for (int x = 0; x < BlockFlower.field_149859_a.length; x++) - { - this.addFlower(Blocks.red_flower, x == 1 ? 0 : x, 10); - } - } - } - - public BiomeGenBase func_150557_a(int p_150557_1_, boolean p_150557_2_) - { - if (this.field_150632_aF == 2) - { - this.field_150609_ah = 353825; - this.color = p_150557_1_; - - if (p_150557_2_) - { - this.field_150609_ah = (this.field_150609_ah & 16711422) >> 1; - } - - return this; - } - else - { - return super.func_150557_a(p_150557_1_, p_150557_2_); - } - } - - public WorldGenAbstractTree func_150567_a(Random p_150567_1_) - { - return (WorldGenAbstractTree)(this.field_150632_aF == 3 && p_150567_1_.nextInt(3) > 0 ? field_150631_aE : (this.field_150632_aF != 2 && p_150567_1_.nextInt(5) != 0 ? this.worldGeneratorTrees : field_150630_aD)); - } - - public String func_150572_a(Random p_150572_1_, int p_150572_2_, int p_150572_3_, int p_150572_4_) - { - if (this.field_150632_aF == 1) - { - double d0 = MathHelper.clamp_double((1.0D + plantNoise.func_151601_a((double)p_150572_2_ / 48.0D, (double)p_150572_4_ / 48.0D)) / 2.0D, 0.0D, 0.9999D); - int l = (int)(d0 * (double)BlockFlower.field_149859_a.length); - - if (l == 1) - { - l = 0; - } - - return BlockFlower.field_149859_a[l]; - } - else - { - return super.func_150572_a(p_150572_1_, p_150572_2_, p_150572_3_, p_150572_4_); - } - } - - public void decorate(World p_76728_1_, Random p_76728_2_, int p_76728_3_, int p_76728_4_) - { - int k; - int l; - int i1; - int j1; - int k1; - - if (this.field_150632_aF == 3) - { - for (k = 0; k < 4; ++k) - { - for (l = 0; l < 4; ++l) - { - i1 = p_76728_3_ + k * 4 + 1 + 8 + p_76728_2_.nextInt(3); - j1 = p_76728_4_ + l * 4 + 1 + 8 + p_76728_2_.nextInt(3); - k1 = p_76728_1_.getHeightValue(i1, j1); - - if (p_76728_2_.nextInt(20) == 0) - { - WorldGenBigMushroom worldgenbigmushroom = new WorldGenBigMushroom(); - worldgenbigmushroom.generate(p_76728_1_, p_76728_2_, i1, k1, j1); - } - else - { - WorldGenAbstractTree worldgenabstracttree = this.func_150567_a(p_76728_2_); - worldgenabstracttree.setScale(1.0D, 1.0D, 1.0D); - - if (worldgenabstracttree.generate(p_76728_1_, p_76728_2_, i1, k1, j1)) - { - worldgenabstracttree.func_150524_b(p_76728_1_, p_76728_2_, i1, k1, j1); - } - } - } - } - } - - k = p_76728_2_.nextInt(5) - 3; - - if (this.field_150632_aF == 1) - { - k += 2; - } - - l = 0; - - while (l < k) - { - i1 = p_76728_2_.nextInt(3); - - if (i1 == 0) - { - genTallFlowers.func_150548_a(1); - } - else if (i1 == 1) - { - genTallFlowers.func_150548_a(4); - } - else if (i1 == 2) - { - genTallFlowers.func_150548_a(5); - } - - j1 = 0; - - while (true) - { - if (j1 < 5) - { - k1 = p_76728_3_ + p_76728_2_.nextInt(16) + 8; - int i2 = p_76728_4_ + p_76728_2_.nextInt(16) + 8; - int l1 = p_76728_2_.nextInt(p_76728_1_.getHeightValue(k1, i2) + 32); - - if (!genTallFlowers.generate(p_76728_1_, p_76728_2_, k1, l1, i2)) - { - ++j1; - continue; - } - } - - ++l; - break; - } - } - - super.decorate(p_76728_1_, p_76728_2_, p_76728_3_, p_76728_4_); - } - - /** - * Provides the basic grass color based on the biome temperature and rainfall - */ - @SideOnly(Side.CLIENT) - public int getBiomeGrassColor(int p_150558_1_, int p_150558_2_, int p_150558_3_) - { - int l = super.getBiomeGrassColor(p_150558_1_, p_150558_2_, p_150558_3_); - return this.field_150632_aF == 3 ? (l & 16711422) + 2634762 >> 1 : l; - } + + public Biome_AustralianForest(int p_i45377_1_, int aWoodMeta) { + super(p_i45377_1_, aWoodMeta); + this.mWoodMeta = aWoodMeta; + this.setColor(353825); + this.setBiomeName("Australian Forest"); + this.setTemperatureRainfall(1.1F, 0.75F); + this.theBiomeDecorator.treesPerChunk = 16; + this.theBiomeDecorator.grassPerChunk = 5; + this.theBiomeDecorator.flowersPerChunk = 2; + this.func_76733_a(5159473); + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityWolf.class, 5, 4, 4)); + } + + public BiomeGenBase func_150557_a(int p_150557_1_, boolean p_150557_2_) { + if (this.mWoodMeta == 2) { + this.field_150609_ah = 353825; + this.color = p_150557_1_; + + if (p_150557_2_) { + this.field_150609_ah = (this.field_150609_ah & 16711422) >> 1; + } + + return this; + } else { + return super.func_150557_a(p_150557_1_, p_150557_2_); + } + } + + public WorldGenAbstractTree func_150567_a(Random p_150567_1_) { + int mTreeType = MathUtils.getRandomFromArray(new int[] { + 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 5, 5, 5, 5 + }); + if (mTreeType == 0) { + return mGenTreeCanopy; + } + else if (mTreeType == 1) { + return mGenTreeAustralian; + } + else if (mTreeType == 2) { + return mGenTreeForest; + } + else if (mTreeType == 3) { + return mGenTreeForest2; + } + else if (mTreeType == 4) { + return this.worldGeneratorSwamp; + } + else { + return MathUtils.randInt(0, 1) == 0 ? this.worldGeneratorTrees : this.worldGeneratorBigTree; + } + } + + public String func_150572_a(Random p_150572_1_, int p_150572_2_, int p_150572_3_, int p_150572_4_) { + if (this.mWoodMeta == 1) { + double d0 = MathHelper.clamp_double( + (1.0D + plantNoise.func_151601_a((double) p_150572_2_ / 48.0D, (double) p_150572_4_ / 48.0D)) + / 2.0D, + 0.0D, 0.9999D); + int l = (int) (d0 * (double) BlockFlower.field_149859_a.length); + + if (l == 1) { + l = 0; + } + + return BlockFlower.field_149859_a[l]; + } else { + return super.func_150572_a(p_150572_1_, p_150572_2_, p_150572_3_, p_150572_4_); + } + } + + public void decorate(World p_76728_1_, Random p_76728_2_, int p_76728_3_, int p_76728_4_) { + int k; + int l; + int i1; + int j1; + int k1; + + if (this.mWoodMeta == 3) { + for (k = 0; k < 4; ++k) { + for (l = 0; l < 4; ++l) { + i1 = p_76728_3_ + k * 4 + 1 + 8 + p_76728_2_.nextInt(3); + j1 = p_76728_4_ + l * 4 + 1 + 8 + p_76728_2_.nextInt(3); + k1 = p_76728_1_.getHeightValue(i1, j1); + + if (p_76728_2_.nextInt(20) == 0) { + WorldGenBigMushroom worldgenbigmushroom = new WorldGenBigMushroom(); + worldgenbigmushroom.generate(p_76728_1_, p_76728_2_, i1, k1, j1); + } else { + WorldGenAbstractTree worldgenabstracttree = this.func_150567_a(p_76728_2_); + worldgenabstracttree.setScale(1.0D, 1.0D, 1.0D); + + if (worldgenabstracttree.generate(p_76728_1_, p_76728_2_, i1, k1, j1)) { + worldgenabstracttree.func_150524_b(p_76728_1_, p_76728_2_, i1, k1, j1); + } + } + } + } + } + + k = p_76728_2_.nextInt(5) - 3; + + if (this.mWoodMeta == 1) { + k += 2; + } + + l = 0; + + while (l < k) { + i1 = p_76728_2_.nextInt(3); + + if (i1 == 0) { + genTallFlowers.func_150548_a(1); + } else if (i1 == 1) { + genTallFlowers.func_150548_a(4); + } else if (i1 == 2) { + genTallFlowers.func_150548_a(5); + } + + j1 = 0; + + while (true) { + if (j1 < 5) { + k1 = p_76728_3_ + p_76728_2_.nextInt(16) + 8; + int i2 = p_76728_4_ + p_76728_2_.nextInt(16) + 8; + int l1 = p_76728_2_.nextInt(p_76728_1_.getHeightValue(k1, i2) + 32); + + if (!genTallFlowers.generate(p_76728_1_, p_76728_2_, k1, l1, i2)) { + ++j1; + continue; + } + } + + ++l; + break; + } + } + + super.decorate(p_76728_1_, p_76728_2_, p_76728_3_, p_76728_4_); + } + + /** + * Provides the basic grass color based on the biome temperature and rainfall + */ + @SideOnly(Side.CLIENT) + public int getBiomeGrassColor(int p_150558_1_, int p_150558_2_, int p_150558_3_) { + int l = super.getBiomeGrassColor(p_150558_1_, p_150558_2_, p_150558_3_); + return this.mWoodMeta == 3 ? (l & 16711422) + 2634762 >> 1 : l; + } + + /** + * Allocate a new BiomeDecorator for this BiomeGenBase + */ + @Override + public BiomeDecorator createBiomeDecorator() + { + return getModdedBiomeDecorator(new CustomDecorator()); + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianOcean.java b/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianOcean.java index d92b5d78c4..ebfb455882 100644 --- a/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianOcean.java +++ b/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianOcean.java @@ -2,9 +2,11 @@ package gtPlusPlus.australia.biome.type; import java.util.Random; +import gtPlusPlus.australia.biome.CustomDecorator; import gtPlusPlus.core.lib.CORE; import net.minecraft.block.Block; import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenOcean; import net.minecraftforge.common.BiomeDictionary; @@ -38,4 +40,13 @@ public class Biome_AustralianOcean extends BiomeGenOcean { { super.genTerrainBlocks(p_150573_1_, p_150573_2_, p_150573_3_, p_150573_4_, p_150573_5_, p_150573_6_, p_150573_7_); } + + /** + * Allocate a new BiomeDecorator for this BiomeGenBase + */ + @Override + public BiomeDecorator createBiomeDecorator() + { + return getModdedBiomeDecorator(new CustomDecorator()); + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianOutback.java b/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianOutback.java index e9705994e3..216bffde4d 100644 --- a/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianOutback.java +++ b/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianOutback.java @@ -2,6 +2,7 @@ package gtPlusPlus.australia.biome.type; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.australia.biome.CustomDecorator; import gtPlusPlus.core.lib.CORE; import java.util.Arrays; @@ -10,6 +11,7 @@ import net.minecraft.block.Block; 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.biome.BiomeGenMesa; import net.minecraft.world.gen.NoiseGeneratorPerlin; @@ -41,7 +43,7 @@ public class Biome_AustralianOutback extends BiomeGenMesa this.fillerBlock = Blocks.stained_hardened_clay; this.theBiomeDecorator.deadBushPerChunk = 20; this.theBiomeDecorator.reedsPerChunk = 3; - this.theBiomeDecorator.cactiPerChunk = 5; + this.theBiomeDecorator.cactiPerChunk = 15; this.theBiomeDecorator.flowersPerChunk = 0; this.spawnableCreatureList.clear(); this.theBiomeDecorator.treesPerChunk = 5; @@ -77,7 +79,7 @@ public class Biome_AustralianOutback extends BiomeGenMesa { Random random1 = new Random(this.field_150622_aD); this.field_150623_aE = new NoiseGeneratorPerlin(random1, 4); - this.field_150624_aF = new NoiseGeneratorPerlin(random1, 1); + this.field_150624_aF = new NoiseGeneratorPerlin(random1, 2); } this.field_150622_aD = p_150573_1_.getSeed(); @@ -96,7 +98,7 @@ public class Biome_AustralianOutback extends BiomeGenMesa double d2 = 0.001953125D; double d3 = Math.abs(this.field_150624_aF.func_151601_a((double)k * d2, (double)l * d2)); d5 = d1 * d1 * 2.5D; - double d4 = Math.ceil(d3 * 50.0D) + 14.0D; + double d4 = Math.ceil(d3 * 50.0D) + 32.0D; if (d5 > d4) { @@ -112,15 +114,15 @@ public class Biome_AustralianOutback extends BiomeGenMesa boolean flag = true; Block block = Blocks.stained_hardened_clay; Block block2 = this.fillerBlock; - int i1 = (int)(p_150573_7_ / 3.0D + 3.0D + p_150573_2_.nextDouble() * 0.25D); - boolean flag1 = Math.cos(p_150573_7_ / 3.0D * Math.PI) > 0.0D; + int i1 = (int)(p_150573_7_ / 3.3D + 3.2D + p_150573_2_.nextDouble() * 0.25D); + boolean flag1 = Math.cos(p_150573_7_ / 2.5D * CORE.PI) > 0.0D; int j1 = -1; boolean flag2 = false; int k1 = p_150573_3_.length / 256; for (int l1 = 255; l1 >= 0; --l1) { - int i2 = (l * 16 + k) * k1 + l1; + int i2 = (l * 8 + k) * k1 + l1; if ((p_150573_3_[i2] == null || p_150573_3_[i2].getMaterial() == Material.air) && l1 < (int)d5) { @@ -256,23 +258,23 @@ public class Biome_AustralianOutback extends BiomeGenMesa public void func_150619_a(long p_150619_1_) { - this.field_150621_aC = new byte[64]; + this.field_150621_aC = new byte[128]; Arrays.fill(this.field_150621_aC, (byte)16); Random random = new Random(p_150619_1_); - this.field_150625_aG = new NoiseGeneratorPerlin(random, 1); + this.field_150625_aG = new NoiseGeneratorPerlin(random, 3); int j; - for (j = 0; j < 64; ++j) + for (j = 0; j < 128; ++j) { - j += random.nextInt(5) + 1; + j += random.nextInt(8) + 1; - if (j < 64) + if (j < 128) { this.field_150621_aC[j] = 1; } } - j = random.nextInt(4) + 2; + j = random.nextInt(7) + 2; int k; int l; int i1; @@ -280,51 +282,51 @@ public class Biome_AustralianOutback extends BiomeGenMesa for (k = 0; k < j; ++k) { - l = random.nextInt(3) + 1; - i1 = random.nextInt(64); + l = random.nextInt(7) + 1; + i1 = random.nextInt(128); - for (j1 = 0; i1 + j1 < 64 && j1 < l; ++j1) + for (j1 = 0; i1 + j1 < 128 && j1 < l; ++j1) { this.field_150621_aC[i1 + j1] = 4; } } - k = random.nextInt(4) + 2; + k = random.nextInt(6) + 2; int k1; for (l = 0; l < k; ++l) { - i1 = random.nextInt(3) + 2; - j1 = random.nextInt(64); + i1 = random.nextInt(7) + 2; + j1 = random.nextInt(128); - for (k1 = 0; j1 + k1 < 64 && k1 < i1; ++k1) + for (k1 = 0; j1 + k1 < 128 && k1 < i1; ++k1) { this.field_150621_aC[j1 + k1] = 12; } } - l = random.nextInt(4) + 2; + l = random.nextInt(7) + 2; for (i1 = 0; i1 < l; ++i1) { - j1 = random.nextInt(3) + 1; - k1 = random.nextInt(64); + j1 = random.nextInt(5) + 1; + k1 = random.nextInt(128); - for (int l1 = 0; k1 + l1 < 64 && l1 < j1; ++l1) + for (int l1 = 0; k1 + l1 < 128 && l1 < j1; ++l1) { this.field_150621_aC[k1 + l1] = 14; } } - i1 = random.nextInt(3) + 3; + i1 = random.nextInt(8) + 3; j1 = 0; for (k1 = 0; k1 < i1; ++k1) { byte b0 = 1; - j1 += random.nextInt(16) + 4; + j1 += random.nextInt(8) + 4; - for (int i2 = 0; j1 + i2 < 64 && i2 < b0; ++i2) + for (int i2 = 0; j1 + i2 < 128 && i2 < b0; ++i2) { this.field_150621_aC[j1 + i2] = 0; @@ -364,5 +366,14 @@ public class Biome_AustralianOutback extends BiomeGenMesa int l = (int)Math.round(this.field_150625_aG.func_151601_a((double)p_150618_1_ * 1.0D / 512.0D, (double)p_150618_1_ * 1.0D / 512.0D) * 2.0D); return this.field_150621_aC[(p_150618_2_ + l + 64) % 64]; } + + /** + * Allocate a new BiomeDecorator for this BiomeGenBase + */ + @Override + public BiomeDecorator createBiomeDecorator() + { + return getModdedBiomeDecorator(new CustomDecorator()); + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianPlains.java b/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianPlains.java index efbc0111ed..5834e459c8 100644 --- a/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianPlains.java +++ b/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianPlains.java @@ -2,11 +2,13 @@ package gtPlusPlus.australia.biome.type; import java.util.Random; +import gtPlusPlus.australia.biome.CustomDecorator; import gtPlusPlus.core.lib.CORE; import net.minecraft.block.BlockFlower; import net.minecraft.entity.passive.EntityHorse; 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.biome.BiomeGenPlains; import net.minecraftforge.common.BiomeDictionary; @@ -109,4 +111,13 @@ public class Biome_AustralianPlains extends BiomeGenPlains super.decorate(p_76728_1_, p_76728_2_, p_76728_3_, p_76728_4_); } + + /** + * Allocate a new BiomeDecorator for this BiomeGenBase + */ + @Override + public BiomeDecorator createBiomeDecorator() + { + return getModdedBiomeDecorator(new CustomDecorator()); + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/australia/block/BlockAustraliaPortal.java b/src/Java/gtPlusPlus/australia/block/BlockAustraliaPortal.java index 3b8c9e577e..44ece25e43 100644 --- a/src/Java/gtPlusPlus/australia/block/BlockAustraliaPortal.java +++ b/src/Java/gtPlusPlus/australia/block/BlockAustraliaPortal.java @@ -205,7 +205,7 @@ public class BlockAustraliaPortal extends BlockBreakable implements ITileTooltip */ public void onNeighborBlockChange(BlockPos pos) { int x = pos.xPos, y = pos.yPos, z = pos.zPos; - Logger.INFO("Trigger"); + //Logger.INFO("Trigger"); int blockCount = 0; BlockPos portal = pos; World par1World = portal.world; diff --git a/src/Java/gtPlusPlus/australia/chunk/ChunkProviderAustralia.java b/src/Java/gtPlusPlus/australia/chunk/ChunkProviderAustralia.java index 071b5ab589..623d4b8ee1 100644 --- a/src/Java/gtPlusPlus/australia/chunk/ChunkProviderAustralia.java +++ b/src/Java/gtPlusPlus/australia/chunk/ChunkProviderAustralia.java @@ -560,31 +560,39 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh @Override public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) { - super.populate(par1IChunkProvider, par2, par3); + if (this.worldObj.getChunkFromChunkCoords(par2, par3) != null) { + super.populate(par1IChunkProvider, par2, par3); + try { + //Maybe Custom stuff? + boolean doGen = false; + boolean flag = false; + int k1; + int l1; + int i2; + int x = par2 * 16; + int z = par3 * 16; + BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(x + 16, z + 16); + MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, rand, par2, par3, flag)); + doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON); + for (k1 = 0; doGen && k1 < 8; ++k1) { + l1 = x + this.rand.nextInt(16) + 8; + i2 = this.rand.nextInt(256); + int j2 = z + this.rand.nextInt(16) + 8; + (new WorldGenDungeons()).generate(this.worldObj, this.rand, l1, i2, j2); + } + + if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, ANIMALS)) { + SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, x + 8, z + 8, 16, 16, this.rand); + SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, x + 8, z + 8, 16, 16, this.rand); + } + MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, flag)); + } + catch (Throwable t) { + t.printStackTrace(); + } + } - //Maybe Custom stuff? - boolean doGen = false; - boolean flag = false; - int k1; - int l1; - int i2; - int x = par2 * 16; - int z = par3 * 16; - BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(x + 16, z + 16); - MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, rand, par2, par3, flag)); - doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON); - for (k1 = 0; doGen && k1 < 8; ++k1) { - l1 = x + this.rand.nextInt(16) + 8; - i2 = this.rand.nextInt(256); - int j2 = z + this.rand.nextInt(16) + 8; - (new WorldGenDungeons()).generate(this.worldObj, this.rand, l1, i2, j2); - } - if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, ANIMALS)) { - SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, x + 8, z + 8, 16, 16, this.rand); - SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, x + 8, z + 8, 16, 16, this.rand); - } - MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, flag)); /*boolean generateStructures = true; diff --git a/src/Java/gtPlusPlus/australia/gen/map/MapGenLargeRavine.java b/src/Java/gtPlusPlus/australia/gen/map/MapGenLargeRavine.java index 160e734bb7..0eab94c5d1 100644 --- a/src/Java/gtPlusPlus/australia/gen/map/MapGenLargeRavine.java +++ b/src/Java/gtPlusPlus/australia/gen/map/MapGenLargeRavine.java @@ -4,6 +4,7 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Random; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import net.minecraft.block.Block; import net.minecraft.util.MathHelper; @@ -154,7 +155,7 @@ public class MapGenLargeRavine extends MapGenRavine { flag = true; } - gtPlusPlus.api.objects.Logger.WORLD("Generating Large Ravine. 2"); + Logger.WORLD("Generating Large Ravine. 2"); digBlock(aBlocksInChunkOrPassedIn, k3, k2, l3, j3, var1, var2, flag); } diff --git a/src/Java/gtPlusPlus/australia/gen/world/WorldGenAustralianOre.java b/src/Java/gtPlusPlus/australia/gen/world/WorldGenAustralianOre.java new file mode 100644 index 0000000000..9adb84eef2 --- /dev/null +++ b/src/Java/gtPlusPlus/australia/gen/world/WorldGenAustralianOre.java @@ -0,0 +1,87 @@ +package gtPlusPlus.australia.gen.world; + +import java.util.Random; + +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.math.MathUtils; +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.WorldGenerator; + +public class WorldGenAustralianOre extends WorldGenerator { + + private Block mOreToSpawn; + private int numberOfBlocks; + private Block mBlockToReplace; + private int mineableBlockMeta; + + public WorldGenAustralianOre(Block aBlock, int aNumber) { + this(aBlock, aNumber, Blocks.stone); + this.mineableBlockMeta = 0; + } + + public WorldGenAustralianOre(Block aBlock, int aNumber, Block aReplace) { + this.mOreToSpawn = aBlock; + this.numberOfBlocks = aNumber; + this.mBlockToReplace = aReplace; + } + + public WorldGenAustralianOre(Block block, int meta, int number, Block target) { + this(block, number, target); + this.mineableBlockMeta = meta; + } + + + + public boolean generate(World aWorld, Random aRand, int aX, int aY, int aZ) { + float f = MathUtils.randFloat(0f, 1.5f) * CORE.PI; + double d0 = (double) ((float) (aX + 8) + MathHelper.sin(f) * (float) this.numberOfBlocks / 8.0F); + double d1 = (double) ((float) (aX + 8) - MathHelper.sin(f) * (float) this.numberOfBlocks / 8.0F); + double d2 = (double) ((float) (aZ + 8) + MathHelper.cos(f) * (float) this.numberOfBlocks / 8.0F); + double d3 = (double) ((float) (aZ + 8) - MathHelper.cos(f) * (float) this.numberOfBlocks / 8.0F); + double d4 = (double) (aY + aRand.nextInt(MathUtils.randInt(3, 6)) - 2); + double d5 = (double) (aY + aRand.nextInt(MathUtils.randInt(3, 6)) - 2); + + for (int aOreGenerated = 0; aOreGenerated <= this.numberOfBlocks; ++aOreGenerated) { + double d6 = d0 + (d1 - d0) * (double) aOreGenerated / (double) this.numberOfBlocks; + double d7 = d4 + (d5 - d4) * (double) aOreGenerated / (double) this.numberOfBlocks; + double d8 = d2 + (d3 - d2) * (double) aOreGenerated / (double) this.numberOfBlocks; + double d9 = aRand.nextDouble() * (double) this.numberOfBlocks / 16.0D; + double d10 = (double) (MathHelper.sin((float) aOreGenerated * CORE.PI / (float) this.numberOfBlocks) + 1.0F) + * d9 + 1.0D; + double d11 = (double) (MathHelper.sin((float) aOreGenerated * CORE.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 && aWorld.getBlock(k2, l2, i3) + .isReplaceableOreGen(aWorld, k2, l2, i3, mBlockToReplace)) { + aWorld.setBlock(k2, l2, i3, this.mOreToSpawn, mineableBlockMeta, 2); + } + } + } + } + } + } + } + + return true; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/australia/gen/world/WorldGenAustralianTrees.java b/src/Java/gtPlusPlus/australia/gen/world/WorldGenAustralianTrees.java new file mode 100644 index 0000000000..cdcbc24104 --- /dev/null +++ b/src/Java/gtPlusPlus/australia/gen/world/WorldGenAustralianTrees.java @@ -0,0 +1,214 @@ +package gtPlusPlus.australia.gen.world; + +import java.util.Random; + +import gtPlusPlus.core.util.math.MathUtils; +import net.minecraft.block.Block; +import net.minecraft.block.BlockSapling; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.util.Direction; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenTrees; +import net.minecraftforge.common.util.ForgeDirection; + +public class WorldGenAustralianTrees extends WorldGenTrees { + + /** The minimum height of a generated tree. */ + private final int minHeight; + /** True if this tree should grow Vines. */ + private final boolean growVines; + /** The metadata value of the wood to use in tree generation. */ + private final int woodMeta; + /** The metadata value of the leaves to use in tree generation. */ + private final int leavesMeta; + + public WorldGenAustralianTrees(boolean p_i2027_1_) { + this(p_i2027_1_, 4, false); + } + + public WorldGenAustralianTrees(boolean p_i2028_1_, int aMinHeight, boolean aVinesGrow) { + super(p_i2028_1_, aMinHeight, 0, 0, aVinesGrow); + this.minHeight = aMinHeight; + this.woodMeta = 0; + this.leavesMeta = 0; + this.growVines = aVinesGrow; + } + + public boolean generate(World aWorld, Random aRand, int aX, int aY, int aZ) { + int aActualMinHeight = MathUtils.randInt(4, 8) + this.minHeight; + boolean flag = true; + + if (aY >= 1 && aY + aActualMinHeight + 1 <= 256) { + byte b0; + int k1; + Block block; + + for (int i1 = aY; i1 <= aY + 1 + aActualMinHeight; ++i1) { + b0 = 1; + + if (i1 == aY) { + b0 = 0; + } + + if (i1 >= aY + 1 + aActualMinHeight - 2) { + b0 = 2; + } + + for (int j1 = aX - b0; j1 <= aX + b0 && flag; ++j1) { + for (k1 = aZ - b0; k1 <= aZ + b0 && flag; ++k1) { + if (i1 >= 0 && i1 < 256) { + block = aWorld.getBlock(j1, i1, k1); + + if (!this.isReplaceable(aWorld, j1, i1, k1)) { + flag = false; + } + } else { + flag = false; + } + } + } + } + + if (!flag) { + return false; + } else { + Block block2 = aWorld.getBlock(aX, aY - 1, aZ); + + boolean isSoil = block2.canSustainPlant(aWorld, aX, aY - 1, aZ, ForgeDirection.UP, + (BlockSapling) Blocks.sapling); + if (isSoil && aY < 256 - aActualMinHeight - 1) { + block2.onPlantGrow(aWorld, aX, aY - 1, aZ, aX, aY, aZ); + b0 = 3; + byte b1 = 0; + int l1; + int i2; + int j2; + int i3; + + for (k1 = aY - b0 + aActualMinHeight; k1 <= aY + aActualMinHeight; ++k1) { + i3 = k1 - (aY + aActualMinHeight); + l1 = b1 + 5 - i3 / 2; + + for (i2 = aX - l1; i2 <= aX + l1; ++i2) { + j2 = i2 - aX; + + for (int k2 = aZ - l1; k2 <= aZ + l1; ++k2) { + int l2 = k2 - aZ; + + if (Math.abs(j2) != l1 || Math.abs(l2) != l1 || aRand.nextInt(2) != 0 && i3 != 0) { + Block block1 = aWorld.getBlock(i2, k1, k2); + + if (block1.isAir(aWorld, i2, k1, k2) || block1.isLeaves(aWorld, i2, k1, k2)) { + this.setBlockAndNotifyAdequately(aWorld, i2, k1, k2, Blocks.leaves, + this.leavesMeta); + } + } + } + } + } + + for (k1 = 0; k1 < aActualMinHeight; ++k1) { + block = aWorld.getBlock(aX, aY + k1, aZ); + + if (block.isAir(aWorld, aX, aY + k1, aZ) || block.isLeaves(aWorld, aX, aY + k1, aZ)) { + this.setBlockAndNotifyAdequately(aWorld, aX, aY + k1, aZ, Blocks.log, this.woodMeta); + + if (this.growVines && k1 > 0) { + if (aRand.nextInt(3) > 0 && aWorld.isAirBlock(aX - 1, aY + k1, aZ)) { + this.setBlockAndNotifyAdequately(aWorld, aX - 1, aY + k1, aZ, Blocks.vine, 8); + } + + if (aRand.nextInt(3) > 0 && aWorld.isAirBlock(aX + 1, aY + k1, aZ)) { + this.setBlockAndNotifyAdequately(aWorld, aX + 1, aY + k1, aZ, Blocks.vine, 2); + } + + if (aRand.nextInt(3) > 0 && aWorld.isAirBlock(aX, aY + k1, aZ - 1)) { + this.setBlockAndNotifyAdequately(aWorld, aX, aY + k1, aZ - 1, Blocks.vine, 1); + } + + if (aRand.nextInt(3) > 0 && aWorld.isAirBlock(aX, aY + k1, aZ + 1)) { + this.setBlockAndNotifyAdequately(aWorld, aX, aY + k1, aZ + 1, Blocks.vine, 4); + } + } + } + } + + if (this.growVines) { + for (k1 = aY - 3 + aActualMinHeight; k1 <= aY + aActualMinHeight; ++k1) { + i3 = k1 - (aY + aActualMinHeight); + l1 = 2 - i3 / 2; + + for (i2 = aX - l1; i2 <= aX + l1; ++i2) { + for (j2 = aZ - l1; j2 <= aZ + l1; ++j2) { + if (aWorld.getBlock(i2, k1, j2).isLeaves(aWorld, i2, k1, j2)) { + if (aRand.nextInt(4) == 0 + && aWorld.getBlock(i2 - 1, k1, j2).isAir(aWorld, i2 - 1, k1, j2)) { + this.growVines(aWorld, i2 - 1, k1, j2, 8); + } + + if (aRand.nextInt(4) == 0 + && aWorld.getBlock(i2 + 1, k1, j2).isAir(aWorld, i2 + 1, k1, j2)) { + this.growVines(aWorld, i2 + 1, k1, j2, 2); + } + + if (aRand.nextInt(4) == 0 + && aWorld.getBlock(i2, k1, j2 - 1).isAir(aWorld, i2, k1, j2 - 1)) { + this.growVines(aWorld, i2, k1, j2 - 1, 1); + } + + if (aRand.nextInt(4) == 0 + && aWorld.getBlock(i2, k1, j2 + 1).isAir(aWorld, i2, k1, j2 + 1)) { + this.growVines(aWorld, i2, k1, j2 + 1, 4); + } + } + } + } + } + + if (aRand.nextInt(5) == 0 && aActualMinHeight > 5) { + for (k1 = 0; k1 < 2; ++k1) { + for (i3 = 0; i3 < 4; ++i3) { + if (aRand.nextInt(4 - k1) == 0) { + l1 = aRand.nextInt(3); + this.setBlockAndNotifyAdequately(aWorld, + aX + Direction.offsetX[Direction.rotateOpposite[i3]], aY + aActualMinHeight - 5 + k1, + aZ + Direction.offsetZ[Direction.rotateOpposite[i3]], Blocks.cocoa, + l1 << 2 | i3); + } + } + } + } + } + + return true; + } else { + return false; + } + } + } else { + return false; + } + } + + /** + * Grows vines downward from the given block for a given length. Args: World, x, + * starty, z, vine-length + */ + private void growVines(World p_76529_1_, int p_76529_2_, int p_76529_3_, int p_76529_4_, int p_76529_5_) { + this.setBlockAndNotifyAdequately(p_76529_1_, p_76529_2_, p_76529_3_, p_76529_4_, Blocks.vine, p_76529_5_); + int i1 = 4; + + while (true) { + --p_76529_3_; + + if (!p_76529_1_.getBlock(p_76529_2_, p_76529_3_, p_76529_4_).isAir(p_76529_1_, p_76529_2_, p_76529_3_, + p_76529_4_) || i1 <= 0) { + return; + } + + this.setBlockAndNotifyAdequately(p_76529_1_, p_76529_2_, p_76529_3_, p_76529_4_, Blocks.vine, p_76529_5_); + --i1; + } + } +}
\ No newline at end of file |