diff --git a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenDeadForest.java b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenDeadForest.java index 4d458e173..fd444d8c0 100644 --- a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenDeadForest.java +++ b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenDeadForest.java @@ -1,16 +1,16 @@ package biomesoplenty.common.biomes.overworld; +import java.util.Random; + +import net.minecraft.init.Blocks; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; import biomesoplenty.api.BOPBlockHelper; import biomesoplenty.common.biomes.BOPBiome; import biomesoplenty.common.configuration.BOPConfigurationMisc; import biomesoplenty.common.world.features.WorldGenBOPTallGrass; import biomesoplenty.common.world.features.trees.WorldGenBOPTaiga2; -import biomesoplenty.common.world.features.trees.WorldGenDeadTree1; +import biomesoplenty.common.world.features.trees.WorldGenDeadTree; import biomesoplenty.common.world.features.trees.WorldGenOriginalTree; -import net.minecraft.init.Blocks; -import net.minecraft.world.gen.feature.WorldGenAbstractTree; - -import java.util.Random; public class BiomeGenDeadForest extends BOPBiome { @@ -47,7 +47,7 @@ public class BiomeGenDeadForest extends BOPBiome //TODO: getRandomWorldGenForTrees() public WorldGenAbstractTree func_150567_a(Random random) { - return random.nextInt(3) == 0 ? new WorldGenDeadTree1(false, Blocks.dirt, Blocks.grass, BOPBlockHelper.get("driedDirt"), BOPBlockHelper.get("mud")) : + return random.nextInt(3) == 0 ? new WorldGenDeadTree() : (random.nextInt(4) == 0 ? new WorldGenBOPTaiga2(Blocks.log, Blocks.leaves, 1, 1, false, 9, 9, 1) : new WorldGenOriginalTree(Blocks.log, BOPBlockHelper.get("leaves2"), 0, 0, false, 5, 3, false)); } diff --git a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenDeadSwamp.java b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenDeadSwamp.java index d1c026163..18ae2088e 100644 --- a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenDeadSwamp.java +++ b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenDeadSwamp.java @@ -1,17 +1,17 @@ package biomesoplenty.common.biomes.overworld; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; import biomesoplenty.api.BOPBlockHelper; import biomesoplenty.common.biomes.BOPBiome; import biomesoplenty.common.configuration.BOPConfigurationMisc; import biomesoplenty.common.world.features.WorldGenBOPDoubleFlora; import biomesoplenty.common.world.features.WorldGenBOPTallGrass; -import biomesoplenty.common.world.features.trees.WorldGenDeadTree1; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraft.world.gen.feature.WorldGenAbstractTree; - -import java.util.Random; +import biomesoplenty.common.world.features.trees.WorldGenDeadTree; public class BiomeGenDeadSwamp extends BOPBiome { @@ -58,7 +58,7 @@ public class BiomeGenDeadSwamp extends BOPBiome //TODO: getRandomWorldGenForTrees() public WorldGenAbstractTree func_150567_a(Random random) { - return new WorldGenDeadTree1(false, Blocks.dirt, Blocks.grass, BOPBlockHelper.get("driedDirt"), BOPBlockHelper.get("mud")); + return new WorldGenDeadTree(); } @Override diff --git a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenFen.java b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenFen.java index 1fa69d6a6..e1176cdbf 100644 --- a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenFen.java +++ b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenFen.java @@ -1,5 +1,12 @@ package biomesoplenty.common.biomes.overworld; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.entity.monster.EntitySlime; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; import biomesoplenty.api.BOPBlockHelper; import biomesoplenty.common.biomes.BOPBiome; import biomesoplenty.common.world.features.WorldGenBOPDoubleFlora; @@ -8,14 +15,7 @@ import biomesoplenty.common.world.features.WorldGenBOPTallGrass; import biomesoplenty.common.world.features.WorldGenMoss; import biomesoplenty.common.world.features.trees.WorldGenBOPTaiga1; import biomesoplenty.common.world.features.trees.WorldGenBOPTaiga2; -import biomesoplenty.common.world.features.trees.WorldGenDeadTree1; -import net.minecraft.block.Block; -import net.minecraft.entity.monster.EntitySlime; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraft.world.gen.feature.WorldGenAbstractTree; - -import java.util.Random; +import biomesoplenty.common.world.features.trees.WorldGenDeadTree; public class BiomeGenFen extends BOPBiome { @@ -69,7 +69,7 @@ public class BiomeGenFen extends BOPBiome public WorldGenAbstractTree func_150567_a(Random random) { return random.nextInt(3) == 0 ? new WorldGenBOPTaiga2(Blocks.log2, BOPBlockHelper.get("leaves2"), 1, 0, false, 10, 12, 3) : - (random.nextInt(20) == 0 ? new WorldGenDeadTree1(false, Blocks.dirt, Blocks.grass, BOPBlockHelper.get("driedDirt"), BOPBlockHelper.get("mud")) : + (random.nextInt(20) == 0 ? new WorldGenDeadTree() : new WorldGenBOPTaiga1(Blocks.log2, Blocks.leaves2, 1, 1, false, 7, 5, 1)); } diff --git a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenLushDesert.java b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenLushDesert.java index 1d6662f16..07a130da6 100644 --- a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenLushDesert.java +++ b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenLushDesert.java @@ -1,20 +1,20 @@ package biomesoplenty.common.biomes.overworld; -import biomesoplenty.api.BOPBlockHelper; -import biomesoplenty.common.biomes.BOPBiome; -import biomesoplenty.common.world.features.WorldGenBOPDoubleFlora; -import biomesoplenty.common.world.features.WorldGenBOPFlora; -import biomesoplenty.common.world.features.WorldGenBOPTallGrass; -import biomesoplenty.common.world.features.trees.WorldGenCypress; -import biomesoplenty.common.world.features.trees.WorldGenDeadTree1; +import java.util.Random; + import net.minecraft.block.Block; import net.minecraft.entity.passive.EntityHorse; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenAbstractTree; import net.minecraft.world.gen.feature.WorldGenShrub; - -import java.util.Random; +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.biomes.BOPBiome; +import biomesoplenty.common.world.features.WorldGenBOPDoubleFlora; +import biomesoplenty.common.world.features.WorldGenBOPFlora; +import biomesoplenty.common.world.features.WorldGenBOPTallGrass; +import biomesoplenty.common.world.features.trees.WorldGenCypress; +import biomesoplenty.common.world.features.trees.WorldGenDeadTree; public class BiomeGenLushDesert extends BOPBiome { @@ -68,7 +68,7 @@ public class BiomeGenLushDesert extends BOPBiome public WorldGenAbstractTree func_150567_a(Random random) { return random.nextInt(4) == 0 ? new WorldGenCypress(Blocks.log2, Blocks.leaves2, 0, 0, false, 7, 10, 2) : - (random.nextInt(18) == 0 ? new WorldGenDeadTree1(false, Blocks.dirt, Blocks.grass, BOPBlockHelper.get("grass"), BOPBlockHelper.get("driedDirt"), Blocks.hardened_clay) : + (random.nextInt(18) == 0 ? new WorldGenDeadTree() : (random.nextInt(2) == 0 ? worldGeneratorTrees : new WorldGenShrub(0,0))); } diff --git a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenOminousWoods.java b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenOminousWoods.java index 24553ca0b..7336150d2 100644 --- a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenOminousWoods.java +++ b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenOminousWoods.java @@ -1,20 +1,20 @@ package biomesoplenty.common.biomes.overworld; -import biomesoplenty.api.BOPBlockHelper; -import biomesoplenty.common.biomes.BOPBiome; -import biomesoplenty.common.configuration.BOPConfigurationMisc; -import biomesoplenty.common.world.features.WorldGenBOPFlora; -import biomesoplenty.common.world.features.trees.WorldGenBOPSwampTree; -import biomesoplenty.common.world.features.trees.WorldGenBOPTaiga2; -import biomesoplenty.common.world.features.trees.WorldGenDeadTree1; +import java.util.Random; + import net.minecraft.entity.monster.EntityCaveSpider; import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.entity.passive.EntityBat; import net.minecraft.init.Blocks; import net.minecraft.world.gen.feature.WorldGenAbstractTree; import net.minecraft.world.gen.feature.WorldGenTallGrass; - -import java.util.Random; +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.biomes.BOPBiome; +import biomesoplenty.common.configuration.BOPConfigurationMisc; +import biomesoplenty.common.world.features.WorldGenBOPFlora; +import biomesoplenty.common.world.features.trees.WorldGenBOPSwampTree; +import biomesoplenty.common.world.features.trees.WorldGenBOPTaiga2; +import biomesoplenty.common.world.features.trees.WorldGenDeadTree; public class BiomeGenOminousWoods extends BOPBiome { @@ -69,7 +69,7 @@ public class BiomeGenOminousWoods extends BOPBiome //TODO: getRandomWorldGenForTrees() public WorldGenAbstractTree func_150567_a(Random random) { - return random.nextInt(2) == 0 ? new WorldGenBOPTaiga2(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves1"), 2, 3, false, 14, 6, 0) : (random.nextInt(6) == 0 ? new WorldGenDeadTree1(false, Blocks.dirt, Blocks.grass, BOPBlockHelper.get("grass"), BOPBlockHelper.get("driedDirt"), BOPBlockHelper.get("redRock")) : new WorldGenBOPSwampTree(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves1"), 2, 3, 5, 4, BOPBlockHelper.get("treeMoss"), -1)); + return random.nextInt(2) == 0 ? new WorldGenBOPTaiga2(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves1"), 2, 3, false, 14, 6, 0) : (random.nextInt(6) == 0 ? new WorldGenDeadTree() : new WorldGenBOPSwampTree(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves1"), 2, 3, 5, 4, BOPBlockHelper.get("treeMoss"), -1)); } @Override diff --git a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenWasteland.java b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenWasteland.java index 7b4f0d38a..eab4192f7 100644 --- a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenWasteland.java +++ b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenWasteland.java @@ -1,14 +1,13 @@ package biomesoplenty.common.biomes.overworld; +import java.util.Random; + +import net.minecraft.world.gen.feature.WorldGenAbstractTree; import biomesoplenty.api.BOPBlockHelper; import biomesoplenty.common.biomes.BOPBiome; import biomesoplenty.common.configuration.BOPConfigurationMisc; import biomesoplenty.common.world.features.WorldGenBOPTallGrass; -import biomesoplenty.common.world.features.trees.WorldGenDeadTree1; -import net.minecraft.init.Blocks; -import net.minecraft.world.gen.feature.WorldGenAbstractTree; - -import java.util.Random; +import biomesoplenty.common.world.features.trees.WorldGenDeadTree; public class BiomeGenWasteland extends BOPBiome { @@ -50,7 +49,7 @@ public class BiomeGenWasteland extends BOPBiome //TODO: getRandomWorldGenForTrees() public WorldGenAbstractTree func_150567_a(Random random) { - return new WorldGenDeadTree1(false, Blocks.dirt, Blocks.grass, BOPBlockHelper.get("grass"), BOPBlockHelper.get("driedDirt"), BOPBlockHelper.get("redRock")); + return new WorldGenDeadTree(); } @Override diff --git a/src/main/java/biomesoplenty/common/biomes/overworld/subbiomes/BiomeGenQuagmire.java b/src/main/java/biomesoplenty/common/biomes/overworld/subbiomes/BiomeGenQuagmire.java index a1cbad531..57447b0bc 100644 --- a/src/main/java/biomesoplenty/common/biomes/overworld/subbiomes/BiomeGenQuagmire.java +++ b/src/main/java/biomesoplenty/common/biomes/overworld/subbiomes/BiomeGenQuagmire.java @@ -5,13 +5,12 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase.Height; import net.minecraft.world.gen.feature.WorldGenAbstractTree; import biomesoplenty.api.BOPBlockHelper; import biomesoplenty.common.biomes.BOPSubBiome; import biomesoplenty.common.configuration.BOPConfigurationMisc; import biomesoplenty.common.world.features.WorldGenBOPTallGrass; -import biomesoplenty.common.world.features.trees.WorldGenDeadTree1; +import biomesoplenty.common.world.features.trees.WorldGenDeadTree; public class BiomeGenQuagmire extends BOPSubBiome { @@ -61,7 +60,7 @@ public class BiomeGenQuagmire extends BOPSubBiome //TODO: getRandomWorldGenForTrees() public WorldGenAbstractTree func_150567_a(Random random) { - return new WorldGenDeadTree1(false, Blocks.dirt, Blocks.grass, BOPBlockHelper.get("driedDirt"), BOPBlockHelper.get("mud")); + return new WorldGenDeadTree(); } @Override diff --git a/src/main/java/biomesoplenty/common/biomes/overworld/subbiomes/BiomeGenSilkglades.java b/src/main/java/biomesoplenty/common/biomes/overworld/subbiomes/BiomeGenSilkglades.java index 1b64f06d3..dd9b78054 100644 --- a/src/main/java/biomesoplenty/common/biomes/overworld/subbiomes/BiomeGenSilkglades.java +++ b/src/main/java/biomesoplenty/common/biomes/overworld/subbiomes/BiomeGenSilkglades.java @@ -6,15 +6,13 @@ import net.minecraft.block.Block; import net.minecraft.entity.monster.EntitySpider; import net.minecraft.init.Blocks; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase.Height; -import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry; import net.minecraft.world.gen.feature.WorldGenAbstractTree; import biomesoplenty.api.BOPBlockHelper; import biomesoplenty.common.biomes.BOPSubBiome; import biomesoplenty.common.configuration.BOPConfigurationMisc; import biomesoplenty.common.world.features.WorldGenBOPTallGrass; import biomesoplenty.common.world.features.trees.WorldGenBOPSwampTree; -import biomesoplenty.common.world.features.trees.WorldGenDeadTree1; +import biomesoplenty.common.world.features.trees.WorldGenDeadTree; public class BiomeGenSilkglades extends BOPSubBiome { @@ -69,7 +67,7 @@ public class BiomeGenSilkglades extends BOPSubBiome public WorldGenAbstractTree func_150567_a(Random random) { return random.nextInt(5) == 0 ? new WorldGenBOPSwampTree(Blocks.log, BOPBlockHelper.get("leaves2"), 0, 0, 6, 9, BOPBlockHelper.get("leaves2"), 0) : - (random.nextInt(7) == 0 ? new WorldGenDeadTree1(false, Blocks.dirt, Blocks.grass, BOPBlockHelper.get("driedDirt"), BOPBlockHelper.get("mud")) : + (random.nextInt(7) == 0 ? new WorldGenDeadTree() : new WorldGenBOPSwampTree(BOPBlockHelper.get("logs3"), BOPBlockHelper.get("colorizedLeaves2"), 1, 0, 6, 9, BOPBlockHelper.get("colorizedLeaves2"), 0)); } diff --git a/src/main/java/biomesoplenty/common/biomes/overworld/techbiomes/BiomeGenDryRiver.java b/src/main/java/biomesoplenty/common/biomes/overworld/techbiomes/BiomeGenDryRiver.java index bbf41d7e0..7735e6afe 100644 --- a/src/main/java/biomesoplenty/common/biomes/overworld/techbiomes/BiomeGenDryRiver.java +++ b/src/main/java/biomesoplenty/common/biomes/overworld/techbiomes/BiomeGenDryRiver.java @@ -23,9 +23,9 @@ public class BiomeGenDryRiver extends BOPBiome this.setHeight(biomeHeight); - this.topBlock = BOPBlockHelper.get("driedDirt"); - this.fillerBlock = BOPBlockHelper.get("driedDirt"); + this.topBlock = Blocks.sand; + this.fillerBlock = Blocks.sand; - this.bopWorldFeatures.setFeature("dryRiverPerChunk", 999); + this.bopWorldFeatures.setFeature("sandstoneSpikesPerChunk", 5); } } \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java b/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java index 228c65951..69a50c399 100644 --- a/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java +++ b/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java @@ -85,7 +85,7 @@ public class BOPWorldFeatures addFeature("gravelSplatterPerChunk", 0); addFeature("redSandSplatterPerChunk", 0); addFeature("dirtSplatterPerChunk", 0); - addFeature("dryRiverPerChunk", 0); + addFeature("sandstoneSpikesPerChunk", 0); addFeature("glowshroomsPerChunk", 0); //Nether Features diff --git a/src/main/java/biomesoplenty/common/world/features/WorldGenSandstoneSpike.java b/src/main/java/biomesoplenty/common/world/features/WorldGenSandstoneSpike.java new file mode 100644 index 000000000..288b39149 --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenSandstoneSpike.java @@ -0,0 +1,145 @@ +package biomesoplenty.common.world.features; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import biomesoplenty.common.world.decoration.BOPDecorationManager; +import biomesoplenty.common.world.generation.WorldGeneratorBOP; + +public class WorldGenSandstoneSpike extends WorldGeneratorBOP +{ + private static final String __OBFID = "CL_00000417"; + + @Override + public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) + { + while (par1World.getBlock(par3, par4, par5) == Blocks.water && par4 > 2) + { + --par4; + } + + if (par1World.getBlock(par3, par4, par5) != Blocks.dirt && par1World.getBlock(par3, par4, par5) != Blocks.sand && par1World.getBlock(par3, par4, par5) != Blocks.stone && par1World.getBlock(par3, par4 + 1, par5) != Blocks.water) + { + return false; + } + else + { + par4 += par2Random.nextInt(4); + int l = par2Random.nextInt(4) + 7; + int i1 = l / 4 + par2Random.nextInt(2); + + int j1; + int k1; + int l1; + + for (j1 = 0; j1 < l; ++j1) + { + float f = (1.0F - (float)j1 / (float)l) * (float)i1; + k1 = MathHelper.ceiling_float_int(f); + + for (l1 = -k1; l1 <= k1; ++l1) + { + float f1 = (float)MathHelper.abs_int(l1) - 0.25F; + + for (int i2 = -k1; i2 <= k1; ++i2) + { + float f2 = (float)MathHelper.abs_int(i2) - 0.25F; + + if ((l1 == 0 && i2 == 0 || f1 * f1 + f2 * f2 <= f * f) && (l1 != -k1 && l1 != k1 && i2 != -k1 && i2 != k1 || par2Random.nextFloat() <= 0.75F)) + { + Block block = par1World.getBlock(par3 + l1, par4 + j1, par5 + i2); + + if (block.getMaterial() == Material.water || block.getMaterial() == Material.air || block == Blocks.dirt || block == Blocks.sand || block == Blocks.stone) + { + this.func_150515_a(par1World, par3 + l1, par4 + j1, par5 + i2, Blocks.sandstone); + } + + if (j1 != 0 && k1 > 1) + { + block = par1World.getBlock(par3 + l1, par4 - j1, par5 + i2); + + if (block.getMaterial() == Material.water || block.getMaterial() == Material.air || block == Blocks.dirt || block == Blocks.sand || block == Blocks.stone) + { + this.func_150515_a(par1World, par3 + l1, par4 - j1, par5 + i2, Blocks.sandstone); + } + } + } + } + } + } + + j1 = i1 - 1; + + if (j1 < 0) + { + j1 = 0; + } + else if (j1 > 1) + { + j1 = 1; + } + + for (int j2 = -j1; j2 <= j1; ++j2) + { + k1 = -j1; + + while (k1 <= j1) + { + l1 = par4 - 1; + int k2 = 50; + + if (Math.abs(j2) == 1 && Math.abs(k1) == 1) + { + k2 = par2Random.nextInt(5); + } + + while (true) + { + if (l1 > 50) + { + Block block1 = par1World.getBlock(par3 + j2, l1, par5 + k1); + + if (block1.getMaterial() == Material.water || block1 == Blocks.dirt || block1 == Blocks.sand || block1 == Blocks.stone) + { + this.func_150515_a(par1World, par3 + j2, l1, par5 + k1, Blocks.sandstone); + --l1; + --k2; + + if (k2 <= 0) + { + l1 -= par2Random.nextInt(5) + 1; + k2 = par2Random.nextInt(5); + } + + continue; + } + } + + ++k1; + break; + } + } + } + + return true; + } + } + + @Override + public void setupGeneration(World world, Random random, BiomeGenBase biome, String featureName, int x, int z) + { + for (int i = 0; i < (Integer)BOPDecorationManager.getBiomeFeatures(biome.biomeID).getFeature(featureName); i++) + { + int randX = x + random.nextInt(16) + 8; + int randZ = z + random.nextInt(16) + 8; + int randY = random.nextInt(world.getHeightValue(randX, randZ) * 2); + + this.generate(world, random, randX, randY, randZ); + } + } +} \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenDeadTree.java b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenDeadTree.java new file mode 100644 index 000000000..9dba4d37b --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenDeadTree.java @@ -0,0 +1,387 @@ +package biomesoplenty.common.world.features.trees; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import biomesoplenty.api.BOPBlockHelper; + +public class WorldGenDeadTree extends WorldGenAbstractTree +{ + private int strengthRand; + private int bMax; + private double offset; + + public WorldGenDeadTree() + { + this(35, 10, 1.3D); + } + + public WorldGenDeadTree(int strengthRand, int bMax, double offset) + { + super(false); + + this.strengthRand = strengthRand; + this.bMax = bMax; + this.offset = offset; + } + + @Override + public boolean generate(World world, Random random, int x, int y, int z) + { + //TODO: isAirBlock() + while (world.isAirBlock(x, y, z) && y > 2) + { + --y; + } + + //TODO: getBlock() + Block block = world.getBlock(x, y, z); + + if (block != Blocks.grass && block != Blocks.dirt && block != BOPBlockHelper.get("driedDirt") && block != Blocks.hardened_clay) + { + return false; + } + else + { + for (int var7 = -2; var7 <= 2; ++var7) + { + for (int var8 = -2; var8 <= 2; ++var8) + { + //TODO: isAirBlock() isAirBlock() isAirBlock() + if (world.isAirBlock(x + var7, y - 1, z + var8) && world.isAirBlock(x + var7, y - 2, z + var8) && !world.isAirBlock(x + var7, y, z + var8)) + { + return false; + } + } + } + + int var999 = random.nextInt(8); + + if (var999 == 0) + { + buildBlock(world, x, y + 1, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 2, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 3, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 4, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 5, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 6, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 7, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 8, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 9, z, BOPBlockHelper.get("logs3"), 2); + + buildBlock(world, x + 1, y + 3, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 2, y + 3, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 1, y + 4, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 2, y + 5, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 3, y + 5, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 1, y + 7, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 2, y + 7, z, BOPBlockHelper.get("logs3"), 6); + + buildBlock(world, x - 1, y + 2, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 2, y + 4, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 1, y + 4, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 1, y + 6, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x - 1, y + 7, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x - 2, y + 8, z, BOPBlockHelper.get("logs3"), 6); + + buildBlock(world, x, y + 3, z + 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 3, z + 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 5, z + 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 6, z + 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 6, z + 3, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 8, z + 1, BOPBlockHelper.get("logs3"), 10); + + buildBlock(world, x, y + 3, z - 1, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 4, z - 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 6, z - 1, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 7, z - 2, BOPBlockHelper.get("logs3"), 10); + } + else if (var999 == 1) + { + buildBlock(world, x, y + 1, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 2, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 3, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 4, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 5, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 6, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 7, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 8, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 9, z, BOPBlockHelper.get("logs3"), 2); + + buildBlock(world, x - 1, y + 3, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 2, y + 3, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 1, y + 4, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 2, y + 5, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 3, y + 5, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 1, y + 7, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 2, y + 7, z, BOPBlockHelper.get("logs3"), 6); + + buildBlock(world, x + 1, y + 2, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 2, y + 4, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 1, y + 4, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 1, y + 6, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x + 1, y + 7, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x + 2, y + 8, z, BOPBlockHelper.get("logs3"), 6); + + buildBlock(world, x, y + 3, z + 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 3, z + 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 5, z + 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 6, z + 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 6, z + 3, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 8, z + 1, BOPBlockHelper.get("logs3"), 10); + + buildBlock(world, x, y + 3, z - 1, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 4, z - 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 6, z - 1, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 7, z - 2, BOPBlockHelper.get("logs3"), 10); + } + else if (var999 == 2) + { + buildBlock(world, x, y + 1, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 2, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 3, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 4, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 5, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 6, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 7, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 8, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 9, z, BOPBlockHelper.get("logs3"), 2); + + buildBlock(world, x + 1, y + 3, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 2, y + 3, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 1, y + 4, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 2, y + 5, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 3, y + 5, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 1, y + 7, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 2, y + 7, z, BOPBlockHelper.get("logs3"), 6); + + buildBlock(world, x - 1, y + 2, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 2, y + 4, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 1, y + 4, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 1, y + 6, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x - 1, y + 7, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x - 2, y + 8, z, BOPBlockHelper.get("logs3"), 6); + + buildBlock(world, x, y + 3, z - 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 3, z - 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 5, z - 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 6, z - 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 6, z - 3, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 8, z - 1, BOPBlockHelper.get("logs3"), 10); + + buildBlock(world, x, y + 3, z + 1, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 4, z + 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 6, z + 1, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 7, z + 2, BOPBlockHelper.get("logs3"), 10); + } + else if (var999 == 3) + { + buildBlock(world, x, y + 1, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 2, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 3, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 4, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 5, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 6, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 7, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 8, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 9, z, BOPBlockHelper.get("logs3"), 2); + + buildBlock(world, x, y + 3, z - 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 3, z - 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 4, z - 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 5, z - 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 5, z - 3, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 7, z - 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 7, z - 2, BOPBlockHelper.get("logs3"), 10); + + buildBlock(world, x, y + 2, z + 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 4, z + 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 4, z + 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 6, z + 1, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 7, z + 1, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 8, z + 2, BOPBlockHelper.get("logs3"), 10); + + buildBlock(world, x - 1, y + 3, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 2, y + 3, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 1, y + 5, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 2, y + 6, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 3, y + 6, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 1, y + 8, z, BOPBlockHelper.get("logs3"), 6); + + buildBlock(world, x + 1, y + 3, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x + 2, y + 4, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 1, y + 6, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x + 2, y + 7, z, BOPBlockHelper.get("logs3"), 6); + } + else if (var999 == 4) + { + buildBlock(world, x, y + 1, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 2, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 3, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 4, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 5, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 6, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 7, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 8, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 9, z, BOPBlockHelper.get("logs3"), 2); + + buildBlock(world, x, y + 3, z + 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 3, z + 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 4, z + 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 5, z + 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 5, z + 3, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 7, z + 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 7, z + 2, BOPBlockHelper.get("logs3"), 10); + + buildBlock(world, x, y + 2, z - 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 4, z - 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 4, z - 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 6, z - 1, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 7, z - 1, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 8, z - 2, BOPBlockHelper.get("logs3"), 10); + + buildBlock(world, x + 1, y + 3, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 2, y + 3, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 1, y + 5, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 2, y + 6, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 3, y + 6, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 1, y + 8, z, BOPBlockHelper.get("logs3"), 6); + + buildBlock(world, x - 1, y + 3, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x - 2, y + 4, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 1, y + 6, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x - 2, y + 7, z, BOPBlockHelper.get("logs3"), 6); + } + else if (var999 == 5) + { + buildBlock(world, x, y + 1, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 2, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 3, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 4, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 5, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 6, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 7, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 8, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 9, z, BOPBlockHelper.get("logs3"), 2); + + buildBlock(world, x, y + 3, z + 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 3, z + 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 4, z + 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 5, z + 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 5, z + 3, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 7, z + 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 7, z + 2, BOPBlockHelper.get("logs3"), 10); + + buildBlock(world, x, y + 2, z - 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 4, z - 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 4, z - 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 6, z - 1, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 7, z - 1, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 8, z - 2, BOPBlockHelper.get("logs3"), 10); + + buildBlock(world, x - 1, y + 3, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 2, y + 3, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 1, y + 5, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 2, y + 6, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 3, y + 6, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 1, y + 8, z, BOPBlockHelper.get("logs3"), 6); + + buildBlock(world, x + 1, y + 3, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x + 2, y + 4, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 1, y + 6, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x + 2, y + 7, z, BOPBlockHelper.get("logs3"), 6); + } + else if (var999 == 6) + { + buildBlock(world, x, y + 1, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 2, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 3, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 4, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 5, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 6, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 7, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 8, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 9, z, BOPBlockHelper.get("logs3"), 2); + + buildBlock(world, x, y + 3, z - 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 3, z - 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 4, z - 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 5, z - 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 5, z - 3, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 7, z - 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 7, z - 2, BOPBlockHelper.get("logs3"), 10); + + buildBlock(world, x, y + 2, z + 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 4, z + 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 4, z + 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 6, z + 1, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 7, z + 1, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 8, z + 2, BOPBlockHelper.get("logs3"), 10); + + buildBlock(world, x + 1, y + 3, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 2, y + 3, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 1, y + 5, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 2, y + 6, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 3, y + 6, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 1, y + 8, z, BOPBlockHelper.get("logs3"), 6); + + buildBlock(world, x - 1, y + 3, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x - 2, y + 4, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 1, y + 6, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x - 2, y + 7, z, BOPBlockHelper.get("logs3"), 6); + } + else + { + buildBlock(world, x, y + 1, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 2, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 3, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 4, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 5, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 6, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 7, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 8, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 9, z, BOPBlockHelper.get("logs3"), 2); + + buildBlock(world, x - 1, y + 3, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 2, y + 3, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 1, y + 4, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 2, y + 5, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 3, y + 5, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 1, y + 7, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x - 2, y + 7, z, BOPBlockHelper.get("logs3"), 6); + + buildBlock(world, x + 1, y + 2, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 2, y + 4, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 1, y + 4, z, BOPBlockHelper.get("logs3"), 6); + buildBlock(world, x + 1, y + 6, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x + 1, y + 7, z, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x + 2, y + 8, z, BOPBlockHelper.get("logs3"), 6); + + buildBlock(world, x, y + 3, z - 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 3, z - 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 5, z - 1, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 6, z - 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 6, z - 3, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 8, z - 1, BOPBlockHelper.get("logs3"), 10); + + buildBlock(world, x, y + 3, z + 1, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 4, z + 2, BOPBlockHelper.get("logs3"), 10); + buildBlock(world, x, y + 6, z + 1, BOPBlockHelper.get("logs3"), 2); + buildBlock(world, x, y + 7, z + 2, BOPBlockHelper.get("logs3"), 10); + } + + return true; + } + } + + public void buildBlock(World world, int x, int y, int z, Block block, int meta) + { + if (world.isAirBlock(x, y, z) || world.getBlock(x, y, z).isLeaves(world, x, y, z)) + { + world.setBlock(x, y, z, block, meta, 2); + } + } +} diff --git a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenDeadTree1.java b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenDeadTree1.java deleted file mode 100644 index a581deabc..000000000 --- a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenDeadTree1.java +++ /dev/null @@ -1,516 +0,0 @@ -package biomesoplenty.common.world.features.trees; - -import java.util.Arrays; -import java.util.List; -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import net.minecraft.world.gen.feature.WorldGenAbstractTree; -import biomesoplenty.api.BOPBlockHelper; - -public class WorldGenDeadTree1 extends WorldGenAbstractTree -{ - /** - * Contains three sets of two values that provide complimentary indices for a given 'major' index - 1 and 2 for 0, 0 - * and 2 for 1, and 0 and 1 for 2. - */ - static final byte[] otherCoordPairs = new byte[] {(byte)2, (byte)0, (byte)0, (byte)1, (byte)2, (byte)1}; - - final List soilBlocks; - - /** random seed for GenBigTree */ - Random rand = new Random(); - - /** Reference to the World object. */ - World worldObj; - int[] basePos = new int[] {0, 0, 0}; - int heightLimit = 0; - int height; - double heightAttenuation = 0.45D; - double branchDensity = 0.25D; - double branchSlope = 0.2D; - double scaleWidth = 1.0D; - double leafDensity = 1.0D; - - /** - * Currently always 1, can be set to 2 in the class constructor to generate a double-sized tree trunk for big trees. - */ - int trunkSize = 1; - - /** - * Sets the limit of the random value used to initialize the height limit. - */ - int heightLimitLimit = 12; - - /** - * Sets the distance limit for how far away the generator will populate leaves from the base leaf node. - */ - int leafDistanceLimit = 4; - - /** Contains a list of a points at which to generate groups of leaves. */ - int[][] leafNodes; - - public WorldGenDeadTree1(boolean par1, Block... soilBlocks) - { - super(par1); - this.soilBlocks = Arrays.asList(soilBlocks); - } - - /** - * Generates a list of leaf nodes for the tree, to be populated by generateLeaves. - */ - void generateLeafNodeList() - { - height = (int)(heightLimit * heightAttenuation); - - if (height >= heightLimit) - { - height = heightLimit - 1; - } - - int var1 = (int)(1.382D + Math.pow(leafDensity * heightLimit / 13.0D, 2.0D)); - - if (var1 < 1) - { - var1 = 1; - } - - int[][] var2 = new int[var1 * heightLimit][4]; - int var3 = basePos[1] + heightLimit - leafDistanceLimit; - int var4 = 1; - int var5 = basePos[1] + height; - int var6 = var3 - basePos[1]; - var2[0][0] = basePos[0]; - var2[0][1] = var3; - var2[0][2] = basePos[2]; - var2[0][3] = var5; - --var3; - - while (var6 >= 0) - { - int var7 = 0; - float var8 = this.layerSize(var6); - - if (var8 < 0.0F) - { - --var3; - --var6; - } - else - { - for (double var9 = 0.5D; var7 < var1; ++var7) - { - double var11 = scaleWidth * var8 * (rand.nextFloat() + 0.328D); - double var13 = rand.nextFloat() * 2.0D * Math.PI; - int var15 = MathHelper.floor_double(var11 * Math.sin(var13) + basePos[0] + var9); - int var16 = MathHelper.floor_double(var11 * Math.cos(var13) + basePos[2] + var9); - int[] var17 = new int[] {var15, var3, var16}; - int[] var18 = new int[] {var15, var3 + leafDistanceLimit, var16}; - - if (this.checkBlockLine(var17, var18) == -1) - { - int[] var19 = new int[] {basePos[0], basePos[1], basePos[2]}; - double var20 = Math.sqrt(Math.pow(Math.abs(basePos[0] - var17[0]), 2.0D) + Math.pow(Math.abs(basePos[2] - var17[2]), 2.0D)); - double var22 = var20 * branchSlope; - - if (var17[1] - var22 > var5) - { - var19[1] = var5; - } - else - { - var19[1] = (int)(var17[1] - var22); - } - - if (this.checkBlockLine(var19, var17) == -1) - { - var2[var4][0] = var15; - var2[var4][1] = var3; - var2[var4][2] = var16; - var2[var4][3] = var19[1]; - ++var4; - } - } - } - - --var3; - --var6; - } - } - - leafNodes = new int[var4][4]; - System.arraycopy(var2, 0, leafNodes, 0, var4); - } - - void genTreeLayer(int par1, int par2, int par3, float par4, byte par5, Block par6) - { - int var7 = (int)(par4 + 0.618D); - byte var8 = otherCoordPairs[par5]; - byte var9 = otherCoordPairs[par5 + 3]; - int[] var10 = new int[] {par1, par2, par3}; - int[] var11 = new int[] {0, 0, 0}; - int var12 = -var7; - int var13 = -var7; - - for (var11[par5] = var10[par5]; var12 <= var7; ++var12) - { - var11[var8] = var10[var8] + var12; - var13 = -var7; - - while (var13 <= var7) - { - double var15 = Math.pow(Math.abs(var12) + 0.5D, 2.0D) + Math.pow(Math.abs(var13) + 0.5D, 2.0D); - - if (var15 > par4 * par4) - { - ++var13; - } - else - { - var11[var9] = var10[var9] + var13; - //TODO: getBlock() - Block var14 = worldObj.getBlock(var11[0], var11[1], var11[2]); - - if (var14 != Blocks.air && var14 != Blocks.leaves) - { - ++var13; - } - else - { - //TODO: setBlockAndMetadata() - this.setBlockAndNotifyAdequately(worldObj, var11[0], var11[1], var11[2], par6, 0); - ++var13; - } - } - } - } - } - - /** - * Gets the rough size of a layer of the tree. - */ - float layerSize(int par1) - { - if (par1 < (heightLimit) * 0.3D) - return -1.618F; - else - { - float var2 = heightLimit / 2.0F; - float var3 = heightLimit / 2.0F - par1; - float var4; - - if (var3 == 0.0F) - { - var4 = var2; - } - else if (Math.abs(var3) >= var2) - { - var4 = 0.0F; - } - else - { - var4 = (float)Math.sqrt(Math.pow(Math.abs(var2), 2.0D) - Math.pow(Math.abs(var3), 2.0D)); - } - - var4 *= 0.5F; - return var4; - } - } - - float leafSize(int par1) - { - return par1 >= 0 && par1 < leafDistanceLimit ? (par1 != 0 && par1 != leafDistanceLimit - 1 ? 3.0F : 2.0F) : -1.0F; - } - - /** - * Generates the leaves surrounding an individual entry in the leafNodes list. - */ - void generateLeafNode(int par1, int par2, int par3) - { - int var4 = par2; - - for (int var5 = par2 + leafDistanceLimit; var4 < var5; ++var4) - { - float var6 = this.leafSize(var4 - par2); - //this.genTreeLayer(par1, var4, par3, var6, (byte)1, Block.leaves.blockID); - } - } - - /** - * Places a line of the specified block ID into the world from the first coordinate triplet to the second. - */ - void placeBlockLine(int[] par1ArrayOfInteger, int[] par2ArrayOfInteger, Block par3) - { - int[] var4 = new int[] {0, 0, 0}; - byte var5 = 0; - byte var6; - - for (var6 = 0; var5 < 3; ++var5) - { - var4[var5] = par2ArrayOfInteger[var5] - par1ArrayOfInteger[var5]; - - if (Math.abs(var4[var5]) > Math.abs(var4[var6])) - { - var6 = var5; - } - } - - if (var4[var6] != 0) - { - byte var7 = otherCoordPairs[var6]; - byte var8 = otherCoordPairs[var6 + 3]; - byte var9; - - if (var4[var6] > 0) - { - var9 = 1; - } - else - { - var9 = -1; - } - - double var10 = (double)var4[var7] / (double)var4[var6]; - double var12 = (double)var4[var8] / (double)var4[var6]; - int[] var14 = new int[] {0, 0, 0}; - int var15 = 0; - - for (int var16 = var4[var6] + var9; var15 != var16; var15 += var9) - { - var14[var6] = MathHelper.floor_double(par1ArrayOfInteger[var6] + var15 + 0.5D); - var14[var7] = MathHelper.floor_double(par1ArrayOfInteger[var7] + var15 * var10 + 0.5D); - var14[var8] = MathHelper.floor_double(par1ArrayOfInteger[var8] + var15 * var12 + 0.5D); - byte var17 = 2; - int var18 = Math.abs(var14[0] - par1ArrayOfInteger[0]); - int var19 = Math.abs(var14[2] - par1ArrayOfInteger[2]); - int var20 = Math.max(var18, var19); - - if (var20 > 0) - { - if (var18 == var20) - { - var17 = 6; - } - else if (var19 == var20) - { - var17 = 10; - } - } - - //TODO: setBlockAndMetadata() - this.setBlockAndNotifyAdequately(worldObj, var14[0], var14[1], var14[2], par3, var17); - } - } - } - - /** - * Generates the leaf portion of the tree as specified by the leafNodes list. - */ - void generateLeaves() - { - int var1 = 0; - - for (int var2 = leafNodes.length; var1 < var2; ++var1) - { - int var3 = leafNodes[var1][0]; - int var4 = leafNodes[var1][1]; - int var5 = leafNodes[var1][2]; - this.generateLeafNode(var3, var4, var5); - } - } - - /** - * Indicates whether or not a leaf node requires additional wood to be added to preserve integrity. - */ - boolean leafNodeNeedsBase(int par1) - { - return par1 >= heightLimit * 0.2D; - } - - /** - * Places the trunk for the big tree that is being generated. Able to generate double-sized trunks by changing a - * field that is always 1 to 2. - */ - void generateTrunk() - { - int var1 = basePos[0]; - int var2 = basePos[1]; - int var3 = basePos[1] + height; - int var4 = basePos[2]; - int[] var5 = new int[] {var1, var2, var4}; - int[] var6 = new int[] {var1, var3, var4}; - this.placeBlockLine(var5, var6, BOPBlockHelper.get("logs3")); - - if (trunkSize == 2) - { - ++var5[0]; - ++var6[0]; - this.placeBlockLine(var5, var6, BOPBlockHelper.get("logs3")); - ++var5[2]; - ++var6[2]; - this.placeBlockLine(var5, var6, BOPBlockHelper.get("logs3")); - var5[0] += -1; - var6[0] += -1; - this.placeBlockLine(var5, var6, BOPBlockHelper.get("logs3")); - } - } - - /** - * Generates additional wood blocks to fill out the bases of different leaf nodes that would otherwise degrade. - */ - void generateLeafNodeBases() - { - int var1 = 0; - int var2 = leafNodes.length; - - for (int[] var3 = new int[] {basePos[0], basePos[1], basePos[2]}; var1 < var2; ++var1) - { - int[] var4 = leafNodes[var1]; - int[] var5 = new int[] {var4[0], var4[1], var4[2]}; - var3[1] = var4[3]; - int var6 = var3[1] - basePos[1]; - - if (this.leafNodeNeedsBase(var6)) - { - this.placeBlockLine(var3, var5, BOPBlockHelper.get("logs3")); - } - } - } - - /** - * Checks a line of blocks in the world from the first coordinate to triplet to the second, returning the distance - * (in blocks) before a non-air, non-leaf block is encountered and/or the end is encountered. - */ - int checkBlockLine(int[] par1ArrayOfInteger, int[] par2ArrayOfInteger) - { - int[] var3 = new int[] {0, 0, 0}; - byte var4 = 0; - byte var5; - - for (var5 = 0; var4 < 3; ++var4) - { - var3[var4] = par2ArrayOfInteger[var4] - par1ArrayOfInteger[var4]; - - if (Math.abs(var3[var4]) > Math.abs(var3[var5])) - { - var5 = var4; - } - } - - if (var3[var5] == 0) - return -1; - else - { - byte var6 = otherCoordPairs[var5]; - byte var7 = otherCoordPairs[var5 + 3]; - byte var8; - - if (var3[var5] > 0) - { - var8 = 1; - } - else - { - var8 = -1; - } - - double var9 = (double)var3[var6] / (double)var3[var5]; - double var11 = (double)var3[var7] / (double)var3[var5]; - int[] var13 = new int[] {0, 0, 0}; - int var14 = 0; - int var15; - - for (var15 = var3[var5] + var8; var14 != var15; var14 += var8) - { - var13[var5] = par1ArrayOfInteger[var5] + var14; - var13[var6] = MathHelper.floor_double(par1ArrayOfInteger[var6] + var14 * var9); - var13[var7] = MathHelper.floor_double(par1ArrayOfInteger[var7] + var14 * var11); - //TODO: getBlock() - Block var16 = worldObj.getBlock(var13[0], var13[1], var13[2]); - - if (var16 != Blocks.air && var16 != Blocks.leaves) - { - break; - } - } - - return var14 == var15 ? -1 : Math.abs(var14); - } - } - - /** - * Returns a boolean indicating whether or not the current location for the tree, spanning basePos to to the height - * limit, is valid. - */ - boolean validTreeLocation() - { - int[] var1 = new int[] {basePos[0], basePos[1], basePos[2]}; - int[] var2 = new int[] {basePos[0], basePos[1] + heightLimit - 1, basePos[2]}; - //TODO: getBlock() - Block var3 = worldObj.getBlock(basePos[0], basePos[1] - 1, basePos[2]); - - if (!soilBlocks.contains(var3)) - return false; - else - { - int var4 = this.checkBlockLine(var1, var2); - - if (var4 == -1) - return true; - else if (var4 < 6) - return false; - else - { - heightLimit = var4; - return true; - } - } - } - - /** - * Rescales the generator settings, only used in WorldGenBigTree - */ - @Override - public void setScale(double par1, double par3, double par5) - { - heightLimitLimit = (int)(par1 * 12.0D); - - if (par1 > 0.5D) - { - leafDistanceLimit = 5; - } - - scaleWidth = par3; - leafDensity = par5; - } - - @Override - public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) - { - worldObj = par1World; - long var6 = par2Random.nextLong(); - rand.setSeed(var6); - basePos[0] = par3; - basePos[1] = par4; - basePos[2] = par5; - - if (heightLimit == 0) - { - heightLimit = 12 + par2Random.nextInt(5); - } - - if (!this.validTreeLocation()) - return false; - else - { - this.generateLeafNodeList(); - this.generateLeaves(); - this.generateTrunk(); - this.generateLeafNodeBases(); - return true; - } - } -} diff --git a/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java b/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java index 7410329d2..7d1285452 100644 --- a/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java +++ b/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java @@ -18,8 +18,8 @@ import biomesoplenty.common.world.features.WorldGenGrassSplatter; import biomesoplenty.common.world.features.WorldGenLavaSpout; import biomesoplenty.common.world.features.WorldGenLog; import biomesoplenty.common.world.features.WorldGenLongVine; -import biomesoplenty.common.world.features.WorldGenOvergrownNetherrack; import biomesoplenty.common.world.features.WorldGenRiverCane; +import biomesoplenty.common.world.features.WorldGenSandstoneSpike; import biomesoplenty.common.world.features.WorldGenSplatter; import biomesoplenty.common.world.features.WorldGenSplotches; import biomesoplenty.common.world.features.WorldGenWasteland; @@ -105,7 +105,7 @@ public class WorldGenFieldAssociation associateFeature("gravelSplatterPerChunk", new WorldGenSplatter(Blocks.gravel, Blocks.grass)); associateFeature("redSandSplatterPerChunk", new WorldGenSplatter(Blocks.sand, 1, BOPBlockHelper.get("hardSand"))); associateFeature("dirtSplatterPerChunk", new WorldGenSplatter(Blocks.dirt, 1, Blocks.grass)); - associateFeature("dryRiverPerChunk", new WorldGenWaterside(BOPBlockHelper.get("driedDirt"), 7, Blocks.water)); + associateFeature("sandstoneSpikesPerChunk", new WorldGenSandstoneSpike()); associateFeature("glowshroomsPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("mushrooms"), 3)); //Nether Features