Java Code Examples for cn.nukkit.block.Block#DIRT

The following examples show how to use cn.nukkit.block.Block#DIRT . 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: MushroomPopulator.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected int getHighestWorkableBlock(ChunkManager level, int x, int z, FullChunk chunk) {
    int y;
    x &= 0xF;
    z &= 0xF;
    for (y = 254; y > 0; --y) {
        int b = chunk.getBlockId(x, y, z);
        if (b == Block.DIRT || b == Block.GRASS) {
            break;
        } else if (b != Block.AIR && b != Block.SNOW_LAYER) {
            return -1;
        }
    }

    return ++y;
}
 
Example 2
Source File: MushroomPopulator.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
private int getHighestWorkableBlock(int x, int z) {
    int y;
    for (y = 127; y > 0; --y) {
        int b = this.level.getBlockIdAt(x, y, z);
        if (b == Block.DIRT || b == Block.GRASS) {
            break;
        } else if (b != Block.AIR && b != Block.SNOW_LAYER) {
            return -1;
        }
    }

    return ++y;
}
 
Example 3
Source File: SpruceBigTreePopulator.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
private int getHighestWorkableBlock(int x, int z) {
    int y;
    for (y = 255; y > 0; --y) {
        int b = this.level.getBlockIdAt(x, y, z);
        if (b == Block.DIRT || b == Block.GRASS) {
            break;
        } else if (b != Block.AIR && b != Block.SNOW_LAYER) {
            return -1;
        }
    }

    return ++y;
}
 
Example 4
Source File: DarkOakTreePopulator.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
private int getHighestWorkableBlock(int x, int z) {
    int y;
    for (y = 255; y > 0; --y) {
        int b = this.level.getBlockIdAt(x, y, z);
        if (b == Block.DIRT || b == Block.GRASS) {
            break;
        } else if (b != Block.AIR && b != Block.SNOW_LAYER) {
            return -1;
        }
    }

    return ++y;
}
 
Example 5
Source File: SwampTreePopulator.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
private int getHighestWorkableBlock(int x, int z) {
    int y;
    for (y = 127; y > 0; --y) {
        int b = this.level.getBlockIdAt(x, y, z);
        if (b == Block.DIRT || b == Block.GRASS) {
            break;
        } else if (b != Block.AIR && b != Block.SNOW_LAYER) {
            return -1;
        }
    }

    return ++y;
}
 
Example 6
Source File: JungleTreePopulator.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
private int getHighestWorkableBlock(int x, int z) {
    int y;
    for (y = 255; y > 0; --y) {
        int b = this.level.getBlockIdAt(x, y, z);
        if (b == Block.DIRT || b == Block.GRASS) {
            break;
        } else if (b != Block.AIR && b != Block.SNOW_LAYER) {
            return -1;
        }
    }

    return ++y;
}
 
Example 7
Source File: DarkOakTreePopulator.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
private int getHighestWorkableBlock(int x, int z) {
    int y;
    for (y = 127; y > 0; --y) {
        int b = this.level.getBlockIdAt(x, y, z);
        if (b == Block.DIRT || b == Block.GRASS) {
            break;
        } else if (b != Block.AIR && b != Block.SNOW_LAYER) {
            return -1;
        }
    }

    return ++y;
}
 
Example 8
Source File: PopulatorTree.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
private int getHighestWorkableBlock(int x, int z) {
    int y;
    for (y = 254; y > 0; --y) {
        int b = this.level.getBlockIdAt(x, y, z);
        if (b == Block.DIRT || b == Block.GRASS) {
            break;
        } else if (b != Block.AIR && b != Block.SNOW_LAYER) {
            return -1;
        }
    }

    return ++y;
}
 
Example 9
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 10
Source File: JungleBigTreePopulator.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
private int getHighestWorkableBlock(int x, int z) {
    int y;
    for (y = 127; y > 0; --y) {
        int b = this.level.getBlockIdAt(x, y, z);
        if (b == Block.DIRT || b == Block.GRASS) {
            break;
        } else if (b != Block.AIR && b != Block.SNOW_LAYER) {
            return -1;
        }
    }

    return ++y;
}
 
Example 11
Source File: DarkOakTreePopulator.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
private int getHighestWorkableBlock(int x, int z) {
    int y;
    for (y = 127; y > 0; --y) {
        int b = this.level.getBlockIdAt(x, y, z);
        if (b == Block.DIRT || b == Block.GRASS) {
            break;
        } else if (b != Block.AIR && b != Block.SNOW_LAYER) {
            return -1;
        }
    }

    return ++y;
}
 
Example 12
Source File: JungleTreePopulator.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
private int getHighestWorkableBlock(int x, int z) {
    int y;
    for (y = 127; y > 0; --y) {
        int b = this.level.getBlockIdAt(x, y, z);
        if (b == Block.DIRT || b == Block.GRASS) {
            break;
        } else if (b != Block.AIR && b != Block.SNOW_LAYER) {
            return -1;
        }
    }

    return ++y;
}
 
Example 13
Source File: JungleTreePopulator.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
private int getHighestWorkableBlock(int x, int z) {
    int y;
    for (y = 127; y > 0; --y) {
        int b = this.level.getBlockIdAt(x, y, z);
        if (b == Block.DIRT || b == Block.GRASS) {
            break;
        } else if (b != Block.AIR && b != Block.SNOW_LAYER) {
            return -1;
        }
    }

    return ++y;
}
 
Example 14
Source File: SavannaTreePopulator.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
private int getHighestWorkableBlock(int x, int z) {
    int y;
    for (y = 127; y > 0; --y) {
        int b = this.level.getBlockIdAt(x, y, z);
        if (b == Block.DIRT || b == Block.GRASS) {
            break;
        } else if (b != Block.AIR && b != Block.SNOW_LAYER) {
            return -1;
        }
    }

    return ++y;
}
 
Example 15
Source File: SavannaTreePopulator.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
private int getHighestWorkableBlock(int x, int z) {
    int y;
    for (y = 127; y > 0; --y) {
        int b = this.level.getBlockIdAt(x, y, z);
        if (b == Block.DIRT || b == Block.GRASS) {
            break;
        } else if (b != Block.AIR && b != Block.SNOW_LAYER) {
            return -1;
        }
    }

    return ++y;
}
 
Example 16
Source File: GrassyBiome.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getGroundBlock() {
    return Block.DIRT;
}
 
Example 17
Source File: WateryBiome.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getGroundBlock() {
    return Block.DIRT;
}
 
Example 18
Source File: WateryBiome.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getSurfaceBlock() {
    return Block.DIRT;
}
 
Example 19
Source File: WateryBiome.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getSurfaceBlock() {
    return Block.DIRT;
}
 
Example 20
Source File: MushroomIsland.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getGroundBlock() {
    return Block.DIRT;
}