/** Ticks the block if it's been scheduled */ public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) { int var6 = par1World.getBlockMetadata(par2, par3, par4); if (var6 < 3 && par5Random.nextInt(10) == 0) { ++var6; par1World.setBlockMetadataWithNotify(par2, par3, par4, var6, 2); } super.updateTick(par1World, par2, par3, par4, par5Random); }
/* * ここで成長処理判定 * world.getBlockLightValueが光度判定 * 9以上なら成長するよという記述 最大15(太陽が一番照っているとき) */ public void updateTick(World world, int i, int j, int k, Random random) { super.updateTick(world, i, j, k, random); if (world.getBlockLightValue(i, j + 1, k) >= 9) { int l = world.getBlockMetadata(i, j, k); if (l < 7) { float f = getGrowthRate(world, i, j, k); if (random.nextInt((int) (25F / f) + 1) == 0) { l++; world.setBlockMetadataWithNotify(i, j, k, l); } } } }
/** Ticks the block if it's been scheduled */ public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) { super.updateTick(par1World, par2, par3, par4, par5Random); if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9) { int var6 = par1World.getBlockMetadata(par2, par3, par4); if (var6 < 7) { float var7 = this.getGrowthRate(par1World, par2, par3, par4); if (par5Random.nextInt((int) (25.0F / var7) + 1) == 0) { ++var6; par1World.setBlockMetadataWithNotify(par2, par3, par4, var6, 2); } } } }
/** Ticks the block if it's been scheduled */ public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) { super.updateTick(par1World, par2, par3, par4, par5Random); if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9) { float f = getGrowthModifier(par1World, par2, par3, par4); if (par5Random.nextInt((int) (25F / f) + 1) == 0) { int i = par1World.getBlockMetadata(par2, par3, par4); if (i < 7) { i++; par1World.setBlockMetadataWithNotify(par2, par3, par4, i); } else { if (par1World.getBlockId(par2 - 1, par3, par4) == fruitType.blockID) { return; } if (par1World.getBlockId(par2 + 1, par3, par4) == fruitType.blockID) { return; } if (par1World.getBlockId(par2, par3, par4 - 1) == fruitType.blockID) { return; } if (par1World.getBlockId(par2, par3, par4 + 1) == fruitType.blockID) { return; } int j = par5Random.nextInt(4); int k = par2; int l = par4; if (j == 0) { k--; } if (j == 1) { k++; } if (j == 2) { l--; } if (j == 3) { l++; } int i1 = par1World.getBlockId(k, par3 - 1, l); if (par1World.getBlockId(k, par3, l) == 0 && (i1 == Block.tilledField.blockID || i1 == Block.dirt.blockID || i1 == Block.grass.blockID)) { par1World.setBlockWithNotify(k, par3, l, fruitType.blockID); } } } } }