// Unsupported sapling
return;
}
// Get the sapling generator
SaplingGen saplingGen = this.getSaplingGen(localWorld, saplingGrower.saplingType, saplingGrower.x, saplingGrower.z);
if (saplingGen == null)
{
// No sapling generator set for this sapling
return;
}
// When we have reached this point, we know that we have to handle the
// event ourselves
// So cancel it
event.setResult(Result.DENY);
// Remove saplings
if (saplingGrower.saplingType.requiresFourSaplings())
{
world.setBlock(saplingGrower.x, saplingGrower.y, saplingGrower.z, Blocks.air);
world.setBlock(saplingGrower.x + 1, saplingGrower.y, saplingGrower.z, Blocks.air);
world.setBlock(saplingGrower.x, saplingGrower.y, saplingGrower.z + 1, Blocks.air);
world.setBlock(saplingGrower.x + 1, saplingGrower.y, saplingGrower.z + 1, Blocks.air);
} else
{
world.setBlock(saplingGrower.x, saplingGrower.y, saplingGrower.z, Blocks.air);
}
// Try ten times to grow sapling
boolean saplingGrown = false;
for (int i = 0; i < 10; i++)
{
if (saplingGen.growSapling(localWorld, new Random(), saplingGrower.x, saplingGrower.y, saplingGrower.z))
{
saplingGrown = true;
break;
}
}