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 + |
