From dcdd216e63f7a074d7650e79f3d8b4bf554643e2 Mon Sep 17 00:00:00 2001 From: Amnet Date: Sun, 21 Apr 2013 14:58:50 +0200 Subject: [PATCH] Everything should now generate properly. --- .../blocks/BlockBOPAppleLeaves.java | 2 +- .../blocks/BlockBOPColorizedLeaves.java | 1 - .../biomesoplenty/blocks/BlockBOPFlower.java | 9 +++++ .../biomesoplenty/blocks/BlockBOPFoliage.java | 9 +++++ .../biomesoplenty/blocks/BlockBOPPlant.java | 34 +++++++++++++++++-- .../biomesoplenty/blocks/BlockBamboo.java | 7 ++++ .../biomesoplenty/blocks/BlockWillow.java | 2 +- .../biomesoplenty/worldgen/WorldGenAlgae.java | 3 +- .../worldgen/WorldGenCherry1.java | 8 ++--- .../worldgen/WorldGenCherry2.java | 8 ++--- .../worldgen/WorldGenDeadTree.java | 2 +- .../worldgen/WorldGenDeadTree3.java | 2 +- 12 files changed, 71 insertions(+), 16 deletions(-) diff --git a/src/minecraft/biomesoplenty/blocks/BlockBOPAppleLeaves.java b/src/minecraft/biomesoplenty/blocks/BlockBOPAppleLeaves.java index 38f37b72c..bbbd810f8 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockBOPAppleLeaves.java +++ b/src/minecraft/biomesoplenty/blocks/BlockBOPAppleLeaves.java @@ -56,7 +56,7 @@ public class BlockBOPAppleLeaves extends BlockLeavesBase implements IShearable @SideOnly(Side.CLIENT) public Icon getIcon(int side, int meta) { - return textures[(!isOpaqueCube() ? 0 : 1)][meta & 7]; + return textures[(!isOpaqueCube() ? 0 : 1)][meta & 3]; } @Override diff --git a/src/minecraft/biomesoplenty/blocks/BlockBOPColorizedLeaves.java b/src/minecraft/biomesoplenty/blocks/BlockBOPColorizedLeaves.java index 4378282e8..89229e0f3 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockBOPColorizedLeaves.java +++ b/src/minecraft/biomesoplenty/blocks/BlockBOPColorizedLeaves.java @@ -67,7 +67,6 @@ public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearab switch (par1) { case 0: - case 4: return ColorizerFoliage.getFoliageColorBirch(); case 3: diff --git a/src/minecraft/biomesoplenty/blocks/BlockBOPFlower.java b/src/minecraft/biomesoplenty/blocks/BlockBOPFlower.java index dfa6c1a4a..a42c60c17 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockBOPFlower.java +++ b/src/minecraft/biomesoplenty/blocks/BlockBOPFlower.java @@ -106,6 +106,11 @@ public class BlockBOPFlower extends BlockFlower list.add(new ItemStack(blockID, 1, i)); } + protected boolean canThisPlantGrowOnThisBlockID(int id) + { + return id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.tilledField.blockID || id == Block.sand.blockID; + } + protected boolean canThisPlantGrowOnThisBlockID(int id, int meta) { switch (meta) @@ -146,6 +151,10 @@ public class BlockBOPFlower extends BlockFlower @Override public boolean canBlockStay(World world, int x, int y, int z) { + if (world.getBlockId(x, y, z) != this.blockID) + return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) + && this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y - 1, z)); + else return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) && this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y - 1, z), world.getBlockMetadata(x, y, z)); } diff --git a/src/minecraft/biomesoplenty/blocks/BlockBOPFoliage.java b/src/minecraft/biomesoplenty/blocks/BlockBOPFoliage.java index 213359e60..c86955b51 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockBOPFoliage.java +++ b/src/minecraft/biomesoplenty/blocks/BlockBOPFoliage.java @@ -92,6 +92,11 @@ public class BlockBOPFoliage extends BlockFlower implements IShearable else return this.canPlaceBlockOnSide(world, x, y, z, side); } + + protected boolean canThisPlantGrowOnThisBlockID(int id) + { + return id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.tilledField.blockID; + } protected boolean canThisPlantGrowOnThisBlockID(int blockID, int metadata) { @@ -106,6 +111,10 @@ public class BlockBOPFoliage extends BlockFlower implements IShearable @Override public boolean canBlockStay(World world, int x, int y, int z) { + if (world.getBlockId(x, y, z) != this.blockID) + return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) + && this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y - 1, z)); + else return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) && this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y - 1, z), world.getBlockMetadata(x, y, z)); } diff --git a/src/minecraft/biomesoplenty/blocks/BlockBOPPlant.java b/src/minecraft/biomesoplenty/blocks/BlockBOPPlant.java index 4c21031d2..a3cceed8e 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockBOPPlant.java +++ b/src/minecraft/biomesoplenty/blocks/BlockBOPPlant.java @@ -119,6 +119,12 @@ public class BlockBOPPlant extends BlockFlower implements IShearable } } + protected boolean canThisPlantGrowOnThisBlockID(int id) + { + return id == Blocks.driedDirt.get().blockID || id == Block.sand.blockID || id == Blocks.redRock.get().blockID || id == Blocks.holyGrass.get().blockID + || id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.tilledField.blockID; + } + @Override public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int side, ItemStack itemStack) { @@ -157,7 +163,11 @@ public class BlockBOPPlant extends BlockFlower implements IShearable @Override public boolean canBlockStay(World world, int x, int y, int z) { - return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) + if (world.getBlockId(x, y, z) != this.blockID) + return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) + && this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y - 1, z)); + else + return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) && this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y - 1, z), world.getBlockMetadata(x, y, z)); } @@ -179,7 +189,27 @@ public class BlockBOPPlant extends BlockFlower implements IShearable @Override public int idDropped(int par1, Random par2Random, int par3) { - return -1; + if (par1 > 5) + return this.blockID; + else + return -1; + } + + @Override + public int damageDropped(int meta) + { + return meta; + } + + @Override + public int quantityDropped(int meta, int fortune, Random random) + { + if (meta == 6) + return random.nextInt(5) == 0 ? 1 : 0; + else if (meta == 7) + return 1; + else + return 0; } @Override diff --git a/src/minecraft/biomesoplenty/blocks/BlockBamboo.java b/src/minecraft/biomesoplenty/blocks/BlockBamboo.java index b28a464a1..8700f68e9 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockBamboo.java +++ b/src/minecraft/biomesoplenty/blocks/BlockBamboo.java @@ -143,4 +143,11 @@ public class BlockBamboo extends Block { return BOPItems.bambooItem.itemID; } + + @Override + public boolean canSustainLeaves(World world, int x, int y, int z) + { + return true; + } + } diff --git a/src/minecraft/biomesoplenty/blocks/BlockWillow.java b/src/minecraft/biomesoplenty/blocks/BlockWillow.java index 7ac997632..e62940b5a 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockWillow.java +++ b/src/minecraft/biomesoplenty/blocks/BlockWillow.java @@ -232,7 +232,7 @@ public class BlockWillow extends Block implements IShearable */ public int getRenderColor(int par1) { - return ColorizerFoliage.getFoliageColorBasic(); + return ColorizerFoliage.getFoliageColorBirch(); } /** diff --git a/src/minecraft/biomesoplenty/worldgen/WorldGenAlgae.java b/src/minecraft/biomesoplenty/worldgen/WorldGenAlgae.java index 976ecf9ad..ad7dd8383 100644 --- a/src/minecraft/biomesoplenty/worldgen/WorldGenAlgae.java +++ b/src/minecraft/biomesoplenty/worldgen/WorldGenAlgae.java @@ -5,6 +5,7 @@ import java.util.Random; import biomesoplenty.api.Blocks; import biomesoplenty.configuration.BOPBlocks; +import net.minecraft.block.Block; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; @@ -18,7 +19,7 @@ public class WorldGenAlgae extends WorldGenerator int var8 = par4 + par2Random.nextInt(4) - par2Random.nextInt(4); int var9 = par5 + par2Random.nextInt(8) - par2Random.nextInt(8); - if (par1World.isAirBlock(var7, var8, var9) && Blocks.foliage.get().canPlaceBlockAt(par1World, var7, var8, var9)) + if (par1World.isAirBlock(var7, var8, var9) && par1World.getBlockId(var7, var8 - 1, var9) == Block.waterStill.blockID) { par1World.setBlock(var7, var8, var9, Blocks.foliage.get().blockID, 0, 2); } diff --git a/src/minecraft/biomesoplenty/worldgen/WorldGenCherry1.java b/src/minecraft/biomesoplenty/worldgen/WorldGenCherry1.java index 7079d856a..ae77001cf 100644 --- a/src/minecraft/biomesoplenty/worldgen/WorldGenCherry1.java +++ b/src/minecraft/biomesoplenty/worldgen/WorldGenCherry1.java @@ -175,7 +175,7 @@ public class WorldGenCherry1 extends WorldGenerator } else { - this.setBlockAndMetadata(this.worldObj, var11[0], var11[1], var11[2], par6, 0); + this.setBlockAndMetadata(this.worldObj, var11[0], var11[1], var11[2], par6, 1); ++var13; } } @@ -279,7 +279,7 @@ public class WorldGenCherry1 extends WorldGenerator var14[var6] = MathHelper.floor_double((double)(par1ArrayOfInteger[var6] + var15) + 0.5D); var14[var7] = MathHelper.floor_double((double)par1ArrayOfInteger[var7] + (double)var15 * var10 + 0.5D); var14[var8] = MathHelper.floor_double((double)par1ArrayOfInteger[var8] + (double)var15 * var12 + 0.5D); - byte var17 = 0; + byte var17 = 1; int var18 = Math.abs(var14[0] - par1ArrayOfInteger[0]); int var19 = Math.abs(var14[2] - par1ArrayOfInteger[2]); int var20 = Math.max(var18, var19); @@ -288,11 +288,11 @@ public class WorldGenCherry1 extends WorldGenerator { if (var18 == var20) { - var17 = 4; + var17 = 5; } else if (var19 == var20) { - var17 = 8; + var17 = 9; } } diff --git a/src/minecraft/biomesoplenty/worldgen/WorldGenCherry2.java b/src/minecraft/biomesoplenty/worldgen/WorldGenCherry2.java index 365a83833..cd34b62dc 100644 --- a/src/minecraft/biomesoplenty/worldgen/WorldGenCherry2.java +++ b/src/minecraft/biomesoplenty/worldgen/WorldGenCherry2.java @@ -175,7 +175,7 @@ public class WorldGenCherry2 extends WorldGenerator } else { - this.setBlockAndMetadata(this.worldObj, var11[0], var11[1], var11[2], par6, 0); + this.setBlockAndMetadata(this.worldObj, var11[0], var11[1], var11[2], par6, 3); ++var13; } } @@ -279,7 +279,7 @@ public class WorldGenCherry2 extends WorldGenerator var14[var6] = MathHelper.floor_double((double)(par1ArrayOfInteger[var6] + var15) + 0.5D); var14[var7] = MathHelper.floor_double((double)par1ArrayOfInteger[var7] + (double)var15 * var10 + 0.5D); var14[var8] = MathHelper.floor_double((double)par1ArrayOfInteger[var8] + (double)var15 * var12 + 0.5D); - byte var17 = 0; + byte var17 = 1; int var18 = Math.abs(var14[0] - par1ArrayOfInteger[0]); int var19 = Math.abs(var14[2] - par1ArrayOfInteger[2]); int var20 = Math.max(var18, var19); @@ -288,11 +288,11 @@ public class WorldGenCherry2 extends WorldGenerator { if (var18 == var20) { - var17 = 4; + var17 = 5; } else if (var19 == var20) { - var17 = 8; + var17 = 9; } } diff --git a/src/minecraft/biomesoplenty/worldgen/WorldGenDeadTree.java b/src/minecraft/biomesoplenty/worldgen/WorldGenDeadTree.java index 1dbf83ed9..69fa14058 100644 --- a/src/minecraft/biomesoplenty/worldgen/WorldGenDeadTree.java +++ b/src/minecraft/biomesoplenty/worldgen/WorldGenDeadTree.java @@ -280,7 +280,7 @@ public class WorldGenDeadTree extends WorldGenerator var14[var6] = MathHelper.floor_double((double)(par1ArrayOfInteger[var6] + var15) + 0.5D); var14[var7] = MathHelper.floor_double((double)par1ArrayOfInteger[var7] + (double)var15 * var10 + 0.5D); var14[var8] = MathHelper.floor_double((double)par1ArrayOfInteger[var8] + (double)var15 * var12 + 0.5D); - byte var17 = 0; + 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); diff --git a/src/minecraft/biomesoplenty/worldgen/WorldGenDeadTree3.java b/src/minecraft/biomesoplenty/worldgen/WorldGenDeadTree3.java index f0884dfcf..7c276e64e 100644 --- a/src/minecraft/biomesoplenty/worldgen/WorldGenDeadTree3.java +++ b/src/minecraft/biomesoplenty/worldgen/WorldGenDeadTree3.java @@ -280,7 +280,7 @@ public class WorldGenDeadTree3 extends WorldGenerator var14[var6] = MathHelper.floor_double((double)(par1ArrayOfInteger[var6] + var15) + 0.5D); var14[var7] = MathHelper.floor_double((double)par1ArrayOfInteger[var7] + (double)var15 * var10 + 0.5D); var14[var8] = MathHelper.floor_double((double)par1ArrayOfInteger[var8] + (double)var15 * var12 + 0.5D); - byte var17 = 0; + 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);