diff options
Diffstat (limited to 'src/Java')
5 files changed, 129 insertions, 54 deletions
diff --git a/src/Java/gtPlusPlus/australia/biome/CustomDecorator.java b/src/Java/gtPlusPlus/australia/biome/CustomDecorator.java index fcf83898d9..2d9b335d52 100644 --- a/src/Java/gtPlusPlus/australia/biome/CustomDecorator.java +++ b/src/Java/gtPlusPlus/australia/biome/CustomDecorator.java @@ -2,6 +2,9 @@ package gtPlusPlus.australia.biome; import java.util.Random; +import gtPlusPlus.api.interfaces.IGeneratorWorld; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.australia.GTplusplus_Australia; import gtPlusPlus.australia.gen.world.WorldGenAustralianOre; import net.minecraft.block.BlockFlower; import net.minecraft.block.material.Material; @@ -28,21 +31,21 @@ 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); @@ -58,16 +61,35 @@ public class CustomDecorator extends BiomeDecorator { 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_); + int mDecoratorTimeout = 0; + + public void decorateChunk(World aWorld, Random aRand, BiomeGenBase aGen, int aX, int aZ) { + if (this.currentWorld != null && this.chunk_X == aX && this.chunk_Z == aZ) { + try { + while (this.currentWorld != null) { + if (mDecoratorTimeout % 1000 == 0) { + Logger.WORLD("Waiting for chunk @ "+aX+", "+aZ+" to generate. Waited "+mDecoratorTimeout+"ms already."); + } + if (this.currentWorld == null) { + break; + } + if (mDecoratorTimeout >= 5000) { + throw new RuntimeException("Already decorating!!"); + } + mDecoratorTimeout++; + } + } + catch (Throwable t) { + t.printStackTrace(); + throw new RuntimeException("Already decorating!!"); + } + } + if (this.currentWorld == null) { + this.currentWorld = aWorld; + this.randomGenerator = aRand; + this.chunk_X = aX; + this.chunk_Z = aZ; + this.genDecorations(aGen); this.currentWorld = null; this.randomGenerator = null; } @@ -240,23 +262,38 @@ public class CustomDecorator extends BiomeDecorator { 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); + try { + int midX = Math.max(0, 7 / 2); + int midZ = Math.max(0, 7 / 2); + int mCurrentBiomeID = Integer.valueOf(currentWorld.getBiomeGenForCoords(chunk_X+midX, chunk_Z+midZ).biomeID); + + if (mCurrentBiomeID == GTplusplus_Australia.Australian_Outback_Biome.biomeID) { + this.generateLakes = false; + } + + if (mCurrentBiomeID != GTplusplus_Australia.Australian_Outback_Biome.biomeID) { + 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); + } } } + } + catch (Throwable t) { + + } MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(currentWorld, randomGenerator, chunk_X, chunk_Z)); } @@ -280,7 +317,7 @@ public class CustomDecorator extends BiomeDecorator { 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_); + + (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); } 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 2b6ae6bd71..bfb0fb8631 100644 --- a/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianDesert_Ex.java +++ b/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianDesert_Ex.java @@ -23,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 = 100; + this.theBiomeDecorator.cactiPerChunk = 20; this.setColor(16421912); this.setBiomeName("Australian Desert III"); this.setDisableRain(); diff --git a/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianOutback.java b/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianOutback.java index 216bffde4d..e657e78862 100644 --- a/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianOutback.java +++ b/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianOutback.java @@ -35,6 +35,7 @@ public class Biome_AustralianOutback extends BiomeGenMesa this.setBiomeName("Australian Outback"); this.field_150626_aH = false; this.field_150620_aI = false; + this.theBiomeDecorator.generateLakes = false; this.setDisableRain(); this.setTemperatureRainfall(2.0F, 0.0F); this.spawnableCreatureList.clear(); @@ -43,7 +44,7 @@ public class Biome_AustralianOutback extends BiomeGenMesa this.fillerBlock = Blocks.stained_hardened_clay; this.theBiomeDecorator.deadBushPerChunk = 20; this.theBiomeDecorator.reedsPerChunk = 3; - this.theBiomeDecorator.cactiPerChunk = 15; + this.theBiomeDecorator.cactiPerChunk = 8; this.theBiomeDecorator.flowersPerChunk = 0; this.spawnableCreatureList.clear(); this.theBiomeDecorator.treesPerChunk = 5; @@ -78,8 +79,8 @@ public class Biome_AustralianOutback extends BiomeGenMesa if (this.field_150623_aE == null || this.field_150624_aF == null || this.field_150622_aD != p_150573_1_.getSeed()) { Random random1 = new Random(this.field_150622_aD); - this.field_150623_aE = new NoiseGeneratorPerlin(random1, 4); - this.field_150624_aF = new NoiseGeneratorPerlin(random1, 2); + this.field_150623_aE = new NoiseGeneratorPerlin(random1, 3); + this.field_150624_aF = new NoiseGeneratorPerlin(random1, 3); } this.field_150622_aD = p_150573_1_.getSeed(); @@ -114,15 +115,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.3D + 3.2D + p_150573_2_.nextDouble() * 0.25D); - boolean flag1 = Math.cos(p_150573_7_ / 2.5D * CORE.PI) > 0.0D; + 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 j1 = -1; boolean flag2 = false; int k1 = p_150573_3_.length / 256; for (int l1 = 255; l1 >= 0; --l1) { - int i2 = (l * 8 + k) * k1 + l1; + int i2 = (l * 16 + k) * k1 + l1; if ((p_150573_3_[i2] == null || p_150573_3_[i2].getMaterial() == Material.air) && l1 < (int)d5) { @@ -160,7 +161,7 @@ public class Biome_AustralianOutback extends BiomeGenMesa if (l1 < 63 && (block == null || block.getMaterial() == Material.air)) { - block = Blocks.water; + block = Blocks.sandstone; } j1 = i1 + Math.max(0, l1 - 63); @@ -254,6 +255,7 @@ public class Biome_AustralianOutback extends BiomeGenMesa } } } + super.genTerrainBlocks(p_150573_1_, p_150573_2_, p_150573_3_, p_150573_4_, p_150573_5_, p_150573_6_, p_150573_7_); } public void func_150619_a(long p_150619_1_) diff --git a/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianPlains.java b/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianPlains.java index 5834e459c8..4ee24aaca5 100644 --- a/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianPlains.java +++ b/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianPlains.java @@ -68,9 +68,9 @@ public class Biome_AustralianPlains extends BiomeGenPlains } } - public void decorate(World p_76728_1_, Random p_76728_2_, int p_76728_3_, int p_76728_4_) + public void decorate(World aWorld, Random aRand, int aX, int aZ) { - double d0 = plantNoise.func_151601_a((double)(p_76728_3_ + 8) / 200.0D, (double)(p_76728_4_ + 8) / 200.0D); + double d0 = plantNoise.func_151601_a((double)(aX + 8) / 200.0D, (double)(aZ + 8) / 200.0D); int k; int l; int i1; @@ -89,10 +89,10 @@ public class Biome_AustralianPlains extends BiomeGenPlains for (k = 0; k < 7; ++k) { - l = p_76728_3_ + p_76728_2_.nextInt(16) + 8; - i1 = p_76728_4_ + p_76728_2_.nextInt(16) + 8; - j1 = p_76728_2_.nextInt(p_76728_1_.getHeightValue(l, i1) + 32); - genTallFlowers.generate(p_76728_1_, p_76728_2_, l, j1, i1); + l = aX + aRand.nextInt(16) + 8; + i1 = aZ + aRand.nextInt(16) + 8; + j1 = aRand.nextInt(aWorld.getHeightValue(l, i1) + 32); + genTallFlowers.generate(aWorld, aRand, l, j1, i1); } } @@ -102,14 +102,14 @@ public class Biome_AustralianPlains extends BiomeGenPlains for (k = 0; k < 10; ++k) { - l = p_76728_3_ + p_76728_2_.nextInt(16) + 8; - i1 = p_76728_4_ + p_76728_2_.nextInt(16) + 8; - j1 = p_76728_2_.nextInt(p_76728_1_.getHeightValue(l, i1) + 32); - genTallFlowers.generate(p_76728_1_, p_76728_2_, l, j1, i1); + l = aX + aRand.nextInt(16) + 8; + i1 = aZ + aRand.nextInt(16) + 8; + j1 = aRand.nextInt(aWorld.getHeightValue(l, i1) + 32); + genTallFlowers.generate(aWorld, aRand, l, j1, i1); } } - super.decorate(p_76728_1_, p_76728_2_, p_76728_3_, p_76728_4_); + this.theBiomeDecorator.decorateChunk(aWorld, aRand, this, aX, aZ); } /** diff --git a/src/Java/gtPlusPlus/australia/gen/world/WorldGenAustralianTrees.java b/src/Java/gtPlusPlus/australia/gen/world/WorldGenAustralianTrees.java index cdcbc24104..f3529aff0b 100644 --- a/src/Java/gtPlusPlus/australia/gen/world/WorldGenAustralianTrees.java +++ b/src/Java/gtPlusPlus/australia/gen/world/WorldGenAustralianTrees.java @@ -13,7 +13,7 @@ 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. */ @@ -74,12 +74,39 @@ public class WorldGenAustralianTrees extends WorldGenTrees { 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); + boolean isSoil = true; + for (int gh = 0; gh < 5; gh++) { + int xMod, zMod; + if (gh == 0) { + xMod = 1; + zMod = 0; + } + else if (gh == 1) { + xMod = 0; + zMod = 1; + } + else if (gh == 2) { + xMod = -1; + zMod = 0; + } + else if (gh == 3) { + xMod = 0; + zMod = -1; + } + else { + xMod = 0; + zMod = 0; + } + block2 = aWorld.getBlock(aX+xMod, aY - 1, aZ+zMod); + if (block2 == Blocks.air || !block2.canSustainPlant(aWorld, aX+xMod, aY - 1, aZ+zMod, ForgeDirection.UP, (BlockSapling) Blocks.sapling)) { + isSoil = false; + break; + } + } + if (isSoil && aY < 256 - aActualMinHeight - 1) { block2.onPlantGrow(aWorld, aX, aY - 1, aZ, aX, aY, aZ); - b0 = 3; + b0 = 5; byte b1 = 0; int l1; int i2; @@ -88,7 +115,7 @@ public class WorldGenAustralianTrees extends WorldGenTrees { for (k1 = aY - b0 + aActualMinHeight; k1 <= aY + aActualMinHeight; ++k1) { i3 = k1 - (aY + aActualMinHeight); - l1 = b1 + 5 - i3 / 2; + l1 = b1 + 3 - i3 / 2; for (i2 = aX - l1; i2 <= aX + l1; ++i2) { j2 = i2 - aX; @@ -112,7 +139,16 @@ public class WorldGenAustralianTrees extends WorldGenTrees { block = aWorld.getBlock(aX, aY + k1, aZ); if (block.isAir(aWorld, aX, aY + k1, aZ) || block.isLeaves(aWorld, aX, aY + k1, aZ)) { + + //Set Middle Trunk this.setBlockAndNotifyAdequately(aWorld, aX, aY + k1, aZ, Blocks.log, this.woodMeta); + //Set Sides + if (k1 < (aActualMinHeight - 2)) { + if (aWorld.isAirBlock(aX+1, aY + k1, aZ) || block.isLeaves(aWorld, aX+1, aY + k1, aZ)) this.setBlockAndNotifyAdequately(aWorld, aX+1, aY + k1, aZ, Blocks.log, this.woodMeta); + if (aWorld.isAirBlock(aX-1, aY + k1, aZ) || block.isLeaves(aWorld, aX-1, aY + k1, aZ)) this.setBlockAndNotifyAdequately(aWorld, aX-1, aY + k1, aZ, Blocks.log, this.woodMeta); + if (aWorld.isAirBlock(aX, aY + k1, aZ+1) || block.isLeaves(aWorld, aX, aY + k1, aZ+1)) this.setBlockAndNotifyAdequately(aWorld, aX, aY + k1, aZ+1, Blocks.log, this.woodMeta); + if (aWorld.isAirBlock(aX, aY + k1, aZ-1) || block.isLeaves(aWorld, aX, aY + k1, aZ-1)) this.setBlockAndNotifyAdequately(aWorld, aX, aY + k1, aZ-1, Blocks.log, this.woodMeta); + } if (this.growVines && k1 > 0) { if (aRand.nextInt(3) > 0 && aWorld.isAirBlock(aX - 1, aY + k1, aZ)) { |