From f05287a2360b273cb599803ec940e2fa1bdb5c19 Mon Sep 17 00:00:00 2001 From: Amnet Date: Thu, 25 Apr 2013 12:49:08 +0200 Subject: [PATCH] Tweaked the generation of Cattail. --- .../biomesoplenty/worldgen/WorldGenCattail.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/minecraft/biomesoplenty/worldgen/WorldGenCattail.java b/src/minecraft/biomesoplenty/worldgen/WorldGenCattail.java index c353294fa..b347a2c7c 100644 --- a/src/minecraft/biomesoplenty/worldgen/WorldGenCattail.java +++ b/src/minecraft/biomesoplenty/worldgen/WorldGenCattail.java @@ -6,29 +6,31 @@ import biomesoplenty.api.Blocks; import biomesoplenty.configuration.BOPBlocks; import net.minecraft.block.Block; +import net.minecraft.block.material.Material; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; public class WorldGenCattail extends WorldGenerator { - public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) + public boolean generate(World world, Random par2Random, int par3, int par4, int par5) { int var11; - for (boolean var6 = false; ((var11 = par1World.getBlockId(par3, par4, par5)) == 0 || var11 == Block.leaves.blockID) && par4 > 0; --par4) + for (boolean var6 = false; ((var11 = world.getBlockId(par3, par4, par5)) == 0 || var11 == Block.leaves.blockID) && par4 > 0; --par4) { ; } for (int var7 = 0; var7 < 128; ++var7) { - int var8 = par3 + par2Random.nextInt(8) - par2Random.nextInt(8); - int var9 = par4 + par2Random.nextInt(4) - par2Random.nextInt(4); - int var10 = par5 + par2Random.nextInt(8) - par2Random.nextInt(8); + int x = par3 + par2Random.nextInt(8) - par2Random.nextInt(8); + int y = par4 + par2Random.nextInt(4) - par2Random.nextInt(4); + int z = par5 + par2Random.nextInt(8) - par2Random.nextInt(8); - if (par1World.isAirBlock(var8, var9, var10) && Blocks.plants.get().canBlockStay(par1World, var8, var9, var10)) + if (world.isAirBlock(x, y, z) && Blocks.plants.get().canBlockStay(world, x, y, z)) { - par1World.setBlock(var8, var9, var10, Blocks.plants.get().blockID, 7, 2); + if ((world.getBlockMaterial(x - 1, y - 1, z) == Material.water ? true : (world.getBlockMaterial(x + 1, y - 1, z) == Material.water ? true : (world.getBlockMaterial(x, y - 1, z - 1) == Material.water ? true : world.getBlockMaterial(x, y - 1, z + 1) == Material.water)))) + world.setBlock(x, y, z, Blocks.plants.get().blockID, 7, 2); } }