Java Code Examples for cn.nukkit.item.Item#DIRT

The following examples show how to use cn.nukkit.item.Item#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: TreeGenerator.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
/**
 * sets dirt at a specific location if it isn't already dirt
 */
protected void setDirtAt(ChunkManager level, Vector3 pos) {
    if (level.getBlockIdAt((int) pos.x, (int) pos.y, (int) pos.z) != Item.DIRT) {
        this.setBlockAndNotifyAdequately(level, pos, new BlockDirt());
    }
}
 
Example 2
Source File: TreeGenerator.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
protected boolean canGrowInto(int id) {
    return id == Item.AIR || id == Item.LEAVES || id == Item.GRASS || id == Item.DIRT || id == Item.LOG || id == Item.LOG2 || id == Item.SAPLING || id == Item.VINE;
}
 
Example 3
Source File: TreeGenerator.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
protected void setDirtAt(ChunkManager level, Vector3 pos) {
    if (level.getBlockIdAt((int) pos.x, (int) pos.y, (int) pos.z) != Item.DIRT) {
        this.setBlockAndNotifyAdequately(level, pos, Block.get(BlockID.DIRT));
    }
}
 
Example 4
Source File: TreeGenerator.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
/**
 * sets dirt at a specific location if it isn't already dirt
 */
protected void setDirtAt(ChunkManager level, Vector3 pos) {
    if (level.getBlockIdAt((int) pos.x, (int) pos.y, (int) pos.z) != Item.DIRT) {
        this.setBlockAndNotifyAdequately(level, pos, new BlockDirt());
    }
}
 
Example 5
Source File: TreeGenerator.java    From Jupiter with GNU General Public License v3.0 2 votes vote down vote up
/**
 * returns whether or not a tree can grow into a block
 * For example, a tree will not grow into stone
 */
protected boolean canGrowInto(int id) {
    return id == Item.AIR || id == Item.LEAVES || id == Item.GRASS || id == Item.DIRT || id == Item.LOG || id == Item.LOG2 || id == Item.SAPLING || id == Item.VINE;
}
 
Example 6
Source File: TreeGenerator.java    From Nukkit with GNU General Public License v3.0 2 votes vote down vote up
/**
 * returns whether or not a tree can grow into a block
 * For example, a tree will not grow into stone
 */
protected boolean canGrowInto(int id) {
    return id == Item.AIR || id == Item.LEAVES || id == Item.GRASS || id == Item.DIRT || id == Item.LOG || id == Item.LOG2 || id == Item.SAPLING || id == Item.VINE;
}