Java Code Examples for cn.nukkit.math.Vector3#down()

The following examples show how to use cn.nukkit.math.Vector3#down() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HugeTreesGenerator.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
/**
 * returns whether or not there is dirt underneath the block where the tree will be grown.
 * It also generates dirt around the block in a 2x2 square if there is dirt underneath the blockpos.
 */
private boolean ensureDirtsUnderneath(Vector3 pos, ChunkManager worldIn) {
    Vector3 blockpos = pos.down();
    int block = worldIn.getBlockIdAt((int) blockpos.x, (int) blockpos.y, (int) blockpos.z);

    if ((block == Block.GRASS || block == Block.DIRT) && pos.getY() >= 2) {
        this.setDirtAt(worldIn, blockpos);
        this.setDirtAt(worldIn, blockpos.east());
        this.setDirtAt(worldIn, blockpos.south());
        this.setDirtAt(worldIn, blockpos.south().east());
        return true;
    } else {
        return false;
    }
}
 
Example 2
Source File: HugeTreesGenerator.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
private boolean ensureDirtsUnderneath(Vector3 pos, ChunkManager worldIn) {
    Vector3 blockpos = pos.down();
    int block = worldIn.getBlockIdAt((int) blockpos.x, (int) blockpos.y, (int) blockpos.z);

    if ((block == Block.GRASS || block == Block.DIRT) && pos.getY() >= 2) {
        this.setDirtAt(worldIn, blockpos);
        this.setDirtAt(worldIn, blockpos.east());
        this.setDirtAt(worldIn, blockpos.south());
        this.setDirtAt(worldIn, blockpos.south().east());
        return true;
    } else {
        return false;
    }
}
 
Example 3
Source File: HugeTreesGenerator.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
/**
 * returns whether or not there is dirt underneath the block where the tree will be grown.
 * It also generates dirt around the block in a 2x2 square if there is dirt underneath the blockpos.
 */
private boolean ensureDirtsUnderneath(Vector3 pos, ChunkManager worldIn) {
    Vector3 blockpos = pos.down();
    int block = worldIn.getBlockIdAt((int) blockpos.x, (int) blockpos.y, (int) blockpos.z);

    if ((block == Block.GRASS || block == Block.DIRT) && pos.getY() >= 2) {
        this.setDirtAt(worldIn, blockpos);
        this.setDirtAt(worldIn, blockpos.east());
        this.setDirtAt(worldIn, blockpos.south());
        this.setDirtAt(worldIn, blockpos.south().east());
        return true;
    } else {
        return false;
    }
}