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

The following examples show how to use cn.nukkit.block.Block#LEAVES . 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 Nukkit with GNU General Public License v3.0 6 votes vote down vote up
protected void growLeavesLayerStrict(ChunkManager worldIn, Vector3 layerCenter, int width) {
    int i = width * width;

    for (int j = -width; j <= width + 1; ++j) {
        for (int k = -width; k <= width + 1; ++k) {
            int l = j - 1;
            int i1 = k - 1;

            if (j * j + k * k <= i || l * l + i1 * i1 <= i || j * j + i1 * i1 <= i || l * l + k * k <= i) {
                Vector3 blockpos = layerCenter.add(j, 0, k);
                int id = worldIn.getBlockIdAt((int) blockpos.x, (int) blockpos.y, (int) blockpos.z);

                if (id == Block.AIR || id == Block.LEAVES) {
                    this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata);
                }
            }
        }
    }
}
 
Example 2
Source File: HugeTreesGenerator.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
/**
 * grow leaves in a circle with the outsides being within the circle
 */
protected void growLeavesLayerStrict(ChunkManager worldIn, Vector3 layerCenter, int width) {
    int i = width * width;

    for (int j = -width; j <= width + 1; ++j) {
        for (int k = -width; k <= width + 1; ++k) {
            int l = j - 1;
            int i1 = k - 1;

            if (j * j + k * k <= i || l * l + i1 * i1 <= i || j * j + i1 * i1 <= i || l * l + k * k <= i) {
                Vector3 blockpos = layerCenter.add(j, 0, k);
                int id = worldIn.getBlockIdAt((int) blockpos.x, (int) blockpos.y, (int) blockpos.z);

                if (id == Block.AIR || id == Block.LEAVES) {
                    this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata);
                }
            }
        }
    }
}
 
Example 3
Source File: HugeTreesGenerator.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
/**
 * grow leaves in a circle
 */
protected void growLeavesLayer(ChunkManager worldIn, Vector3 layerCenter, int width) {
    int i = width * width;

    for (int j = -width; j <= width; ++j) {
        for (int k = -width; k <= width; ++k) {
            if (j * j + k * k <= i) {
                Vector3 blockpos = layerCenter.add(j, 0, k);
                int id = worldIn.getBlockIdAt((int) blockpos.x, (int) blockpos.y, (int) blockpos.z);

                if (id == Block.AIR || id == Block.LEAVES) {
                    this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata);
                }
            }
        }
    }
}
 
Example 4
Source File: PopulatorCactus.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.AIR && b != Block.LEAVES && b != Block.LEAVES2 && b != Block.SNOW_LAYER) {
            break;
        }
    }

    return y == 0 ? -1 : ++y;
}
 
Example 5
Source File: PopulatorTallSugarcane.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.AIR && b != Block.LEAVES && b != Block.LEAVES2) {
            break;
        }
    }

    return y == 0 ? -1 : ++y;
}
 
Example 6
Source File: PopulatorSugarcane.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.AIR && b != Block.LEAVES && b != Block.LEAVES2) {
            break;
        }
    }

    return y == 0 ? -1 : ++y;
}
 
Example 7
Source File: PopulatorLilyPad.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.AIR && b != Block.LEAVES && b != Block.LEAVES2 && b != Block.SNOW_LAYER) {
            break;
        }
    }

    return y == 0 ? -1 : ++y;
}
 
Example 8
Source File: PopulatorLilyPad.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.AIR && b != Block.LEAVES && b != Block.LEAVES2 && b != Block.SNOW_LAYER) {
            break;
        }
    }

    return y == 0 ? -1 : ++y;
}
 
Example 9
Source File: PopulatorTallSugarcane.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.AIR && b != Block.LEAVES && b != Block.LEAVES2) {
            break;
        }
    }

    return y == 0 ? -1 : ++y;
}
 
Example 10
Source File: ObjectTree.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
private boolean overridable(int id) {
    switch (id) {
        case Block.AIR:
        case Block.SAPLING:
        case Block.LOG:
        case Block.LEAVES:
        case Block.SNOW_LAYER:
        case Block.LOG2:
        case Block.LEAVES2:
            return true;
        default:
            return false;
    }
}
 
Example 11
Source File: PopulatorTallGrass.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.AIR && b != Block.LEAVES && b != Block.LEAVES2 && b != Block.SNOW_LAYER) {
            break;
        }
    }

    return y == 0 ? -1 : ++y;
}
 
Example 12
Source File: ObjectSavannaTree.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
private void placeLeafAt(ChunkManager worldIn, Vector3 pos) {
    int material = worldIn.getBlockIdAt(pos.getFloorX(), pos.getFloorY(), pos.getFloorZ());

    if (material == Block.AIR || material == Block.LEAVES) {
        this.setBlockAndNotifyAdequately(worldIn, pos, LEAF);
    }
}
 
Example 13
Source File: ObjectJungleTree.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getLeafBlock() {
    return Block.LEAVES;
}
 
Example 14
Source File: ObjectBirchTree.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getLeafBlock() {
    return Block.LEAVES;
}
 
Example 15
Source File: ObjectOakTree.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getLeafBlock() {
    return Block.LEAVES;
}
 
Example 16
Source File: ObjectJungleTree.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getLeafBlock() {
    return Block.LEAVES;
}
 
Example 17
Source File: ObjectTree.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
public int getLeafBlock() {
    return Block.LEAVES;
}
 
Example 18
Source File: ObjectBirchTree.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getLeafBlock() {
    return Block.LEAVES;
}
 
Example 19
Source File: ObjectOakTree.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getLeafBlock() {
    return Block.LEAVES;
}
 
Example 20
Source File: ObjectSpruceTree.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getLeafBlock() {
    return Block.LEAVES;
}