@Override
public void placeObject(World w, int x, int y, int z) {
generateLeaves(w, x, y + totalHeight, z, (byte) 2);
final byte leavesEnd = (byte) (totalHeight - 2 - random.nextInt(4));
for (byte yy = (byte) (totalHeight / 2); yy < leavesEnd; yy += random.nextInt(4) + 2) {
final Vector2f randomOffset = Vector2f.createRandomDirection(random);
generateLeaves(w, (int) (x + (randomOffset.getX() * 4f + 0.5f)), y + yy, (int) (z + (randomOffset.getY() * 4f + 0.5f)), (byte) 0);
for (byte branchLengthCount = 0; branchLengthCount < branchLength; branchLengthCount++) {
final int bx = (int) (randomOffset.getX() * branchLengthCount + 1.5f);
final int by = -3 + branchLengthCount / 2;
final int bz = (int) (randomOffset.getY() * branchLengthCount + 1.5f);
final Block block = w.getBlock(x + bx, y + yy + by, z + bz);
block.setMaterial(VanillaMaterials.LOG);
block.setData(logMetadata);
VanillaMaterials.LOG.setFacing(block, BlockFace.fromYaw(MathHelper.getLookAtYaw(new Vector3f(bx, by, bz))));
}