From 07e0e399fa01257e0c06dc6d7a33397923959b31 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Wed, 15 Jan 2014 14:43:21 +1100 Subject: [PATCH] Readded most of the saplings, with the only ones remaining being those for trees that are unused (for now) (Persimmon, Hellbark, Holy, Apple & Mangrove) --- .../blocks/BlockBOPColorizedSapling.java | 21 ++++---- .../common/blocks/BlockBOPSapling.java | 53 +++++++++---------- .../features/trees/WorldGenPalmTree1.java | 25 ++++++--- 3 files changed, 57 insertions(+), 42 deletions(-) diff --git a/src/main/java/biomesoplenty/common/blocks/BlockBOPColorizedSapling.java b/src/main/java/biomesoplenty/common/blocks/BlockBOPColorizedSapling.java index 1ed2e7350..12cd7980d 100644 --- a/src/main/java/biomesoplenty/common/blocks/BlockBOPColorizedSapling.java +++ b/src/main/java/biomesoplenty/common/blocks/BlockBOPColorizedSapling.java @@ -12,10 +12,15 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenShrub; import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraftforge.common.util.ForgeDirection; import biomesoplenty.BiomesOPlenty; +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.world.features.trees.WorldGenBOPSwampTree; +import biomesoplenty.common.world.features.trees.WorldGenPalmTree1; import biomesoplenty.common.world.features.trees.WorldGenPineTree; +import biomesoplenty.common.world.features.trees.WorldGenRedwoodTree2; import biomesoplenty.common.world.features.trees.WorldGenSacredOak; public class BlockBOPColorizedSapling extends BlockSapling @@ -134,25 +139,23 @@ public class BlockBOPColorizedSapling extends BlockSapling /*case 1: // Mangrove Tree obj = new WorldGenMangrove(false); - break; + break;*/ case 2: // Palm Tree rnd = random.nextInt(4); - if (rnd == 0) { - obj = new WorldGenPalmTree1(); - } else { - obj = new WorldGenPalmTree3(); - } + if (rnd == 0) obj = new WorldGenPalmTree1(); + else obj = new WorldGenPalmTree1(25, 8, 1.5D); + break; case 3: // Redwood Tree - obj = new WorldGenRedwoodTree2(false); + obj = new WorldGenRedwoodTree2(BOPBlockHelper.get("logs3"), BOPBlockHelper.get("colorizedLeaves1"), 0, 3, false, 20, 15); break; case 4: // Willow Tree - obj = new WorldGenWillow(); - break;*/ + obj = new WorldGenBOPSwampTree(BOPBlockHelper.get("logs3"), BOPBlockHelper.get("colorizedLeaves2"), 1, 0, 6, 9, BOPBlockHelper.get("colorizedLeaves2"), 0); + break; case 5: // Pine Tree obj = new WorldGenPineTree(); diff --git a/src/main/java/biomesoplenty/common/blocks/BlockBOPSapling.java b/src/main/java/biomesoplenty/common/blocks/BlockBOPSapling.java index a737a13d9..6fdef4bb4 100644 --- a/src/main/java/biomesoplenty/common/blocks/BlockBOPSapling.java +++ b/src/main/java/biomesoplenty/common/blocks/BlockBOPSapling.java @@ -16,6 +16,7 @@ import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraftforge.common.util.ForgeDirection; import biomesoplenty.BiomesOPlenty; import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.world.features.trees.WorldGenBOPBigTree; import biomesoplenty.common.world.features.trees.WorldGenBOPSwampTree; import biomesoplenty.common.world.features.trees.WorldGenBOPTaiga2; import biomesoplenty.common.world.features.trees.WorldGenBulbTree; @@ -70,12 +71,12 @@ public class BlockBOPSapling extends BlockSapling list.add(new ItemStack(block, 1, i)); } } - + public boolean isValidPosition(World world, int x, int y, int z, int metadata) { //TODO: getBlock() Block block = world.func_147439_a(x, y - 1, z); - + switch (metadata) { case 7: // Loftwood @@ -99,7 +100,7 @@ public class BlockBOPSapling extends BlockSapling { //TODO: getBlock() Block soil = world.func_147439_a(x, y - 1, z); - + if (world.getBlockMetadata(x, y, z) != 1) return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) && (soil != null && soil.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this)); @@ -136,11 +137,11 @@ public class BlockBOPSapling extends BlockSapling { /*case 0: // Apple Tree obj = new WorldGenApple(false); - break; + break;*/ case 1: // Autumn Tree - obj = new WorldGenAutumn(false); - break;*/ + obj = new WorldGenOriginalTree(Blocks.log, BOPBlockHelper.get("leaves1"), 2, 0, false, 5, 3, false); + break; case 2: // Bamboo Tree rnd = random.nextInt(8); @@ -152,61 +153,59 @@ public class BlockBOPSapling extends BlockSapling } break; - /*case 3: // Magic Tree - obj = new WorldGenMystic2(false); + case 3: // Magic Tree + obj = new WorldGenOriginalTree(BOPBlockHelper.get("logs2"), BOPBlockHelper.get("leaves1"), 1, 2, false, 5, 3, false); break; - */case 4: // Dark Tree + case 4: // Dark Tree rnd = random.nextInt(8); - if (rnd == 0) { - obj = new WorldGenBOPSwampTree(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves1"), 2, 3, 5, 4); - } else { - obj = new WorldGenBOPTaiga2(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves1"), 2, 3, false, 14, 6, 0); - } + if (rnd == 0) obj = new WorldGenBOPSwampTree(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves1"), 2, 3, 5, 4); + else obj = new WorldGenBOPTaiga2(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves1"), 2, 3, false, 14, 6, 0); + break; - /*case 5: // Dead Tree - obj = new WorldGenDeadTree2(false); + case 5: // Dead Tree + obj = new WorldGenOriginalTree(Blocks.log, BOPBlockHelper.get("leaves2"), 0, 0, false, 5, 3, false); break; case 6: // Fir Tree - obj = new WorldGenTaiga9(false); + obj = new WorldGenBOPTaiga2(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves2"), 3, 1, false, 10, 10, 5); break; - case 7: // Holy Tree + /*case 7: // Holy Tree obj = new WorldGenPromisedTree(false); - break; + break;*/ case 8: // Autumn Tree - obj = new WorldGenAutumn2(false); + obj = new WorldGenOriginalTree(Blocks.log, BOPBlockHelper.get("leaves2"), 0, 3, false, 5, 3, false); break; case 9: // Origin Tree - obj = new WorldGenOriginTree(false); + obj = new WorldGenOriginalTree(Blocks.log, BOPBlockHelper.get("leaves3"), 0, 0, false, 5, 3, false); break; case 10: // Pink Cherry Tree - obj = new WorldGenCherry1(false); + obj = new WorldGenBOPBigTree(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves3"), 1, 1); break; case 11: // Maple Tree - obj = new WorldGenMaple(false); + obj = new WorldGenOriginalTree(Blocks.log, BOPBlockHelper.get("leaves3"), 0, 2, false, 5, 3, false); break; case 12: // White Cherry Tree - obj = new WorldGenCherry2(false); + obj = new WorldGenBOPBigTree(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves3"), 1, 3); break; - case 13: // Hellbark + /*case 13: // Hellbark obj = new WorldGenNetherBush(); break;*/ case 14: // Jacaranda obj = new WorldGenOriginalTree(BOPBlockHelper.get("logs4"), BOPBlockHelper.get("leaves4"), 2, 1); break; - - /*case 15: // Persimmon + + /*case 15: // Persimmon obj = new WorldGenPersimmon(false); break;*/ } diff --git a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenPalmTree1.java b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenPalmTree1.java index d748c67c7..5967ab0d5 100644 --- a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenPalmTree1.java +++ b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenPalmTree1.java @@ -10,9 +10,22 @@ import biomesoplenty.api.BOPBlockHelper; public class WorldGenPalmTree1 extends WorldGenAbstractTree { - public WorldGenPalmTree1() + private int strengthRand; + private int bMax; + private double offset; + + public WorldGenPalmTree1() + { + this(35, 10, 1.3D); + } + + public WorldGenPalmTree1(int strengthRand, int bMax, double offset) { super(false); + + this.strengthRand = strengthRand; + this.bMax = bMax; + this.offset = offset; } @Override @@ -46,7 +59,7 @@ public class WorldGenPalmTree1 extends WorldGenAbstractTree } //settings======== - double strength = random.nextInt(35) / 100D; + double strength = random.nextInt(strengthRand) / 100D; //================ double xoff = 0; @@ -59,18 +72,18 @@ public class WorldGenPalmTree1 extends WorldGenAbstractTree int h = 1; buildBlock(world, x, y, z, Blocks.dirt, 0); - for(int b = 0; b < 10; b++) + for(int b = 0; b < bMax; b++) { buildBlock(world, x + ((int) Math.floor(xoff)), y + h, z + ((int) Math.floor(yoff)), BOPBlockHelper.get("logs2"), 3); - if(b == 9) + if(b == bMax - 1) { generateTop(world, x + ((int) Math.floor(xoff)), y + h, z + ((int) Math.floor(yoff))); } else { h++; - xoff *= 1.3D; - yoff *= 1.3D; + xoff *= offset; + yoff *= offset; } }