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

The following examples show how to use cn.nukkit.block.Block#STILL_WATER . 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: PopulatorCaves.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
protected boolean isSuitableBlock(int block, int blockAbove, Biome biome) {
    if (!(biome instanceof CaveBiome)) {
        return false;
    }

    CaveBiome caveBiome = (CaveBiome) biome;

    if (block == caveBiome.getStoneBlock()) {
        return true;
    }

    if (block == Block.SAND || block == Block.GRAVEL) {
        return !(blockAbove == Block.WATER || blockAbove == Block.STILL_WATER || blockAbove == Block.LAVA || blockAbove == Block.STILL_LAVA);
    }

    if (block == caveBiome.getGroundBlock()) {
        return true;
    }

    if (block == caveBiome.getSurfaceBlock()) {
        return true;
    }

    // Few hardcoded cases
    if (block == Block.TERRACOTTA) {
        return true;
    }

    if (block == Block.SANDSTONE) {
        return true;
    }

    // TODO: add red sandstone case in Minecraft 1.8
    return block == Block.SNOW;

}
 
Example 2
Source File: PopulatorSugarcane.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
private boolean findWater(int x, int y, int z) {
    int count = 0;
    for (int i = x - 4; i < (x + 4); i++) {
        for (int j = z - 4; j < (z + 4); j++) {
            int b = this.level.getBlockIdAt(i, y, j);
            if (b == Block.WATER || b == Block.STILL_WATER) {
                count++;
            }
            if (count > 10) {
                return true;
            }
        }
    }
    return (count > 10);
}
 
Example 3
Source File: PopulatorSugarcane.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
private boolean findWater(int x, int y, int z, Level level) {
    int count = 0;
    for (int i = x - 4; i < (x + 4); i++) {
        for (int j = z - 4; j < (z + 4); j++) {
            int b = level.getBlockIdAt(i, y, j);
            if (b == Block.WATER || b == Block.STILL_WATER) {
                count++;
            }
            if (count > 10) {
                return true;
            }
        }
    }
    return (count > 10);
}
 
Example 4
Source File: PopulatorCaves.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
protected boolean isSuitableBlock(int block, int blockAbove, Biome biome) {
    if (!(biome instanceof CaveBiome)) {
        return false;
    }

    CaveBiome caveBiome = (CaveBiome) biome;

    if (block == caveBiome.getStoneBlock()) {
        return true;
    }

    if (block == Block.SAND || block == Block.GRAVEL) {
        return !(blockAbove == Block.WATER || blockAbove == Block.STILL_WATER || blockAbove == Block.LAVA || blockAbove == Block.STILL_LAVA);
    }

    if (block == caveBiome.getGroundBlock()) {
        return true;
    }

    if (block == caveBiome.getSurfaceBlock()) {
        return true;
    }

    // Few hardcoded cases
    if (block == Block.TERRACOTTA) {
        return true;
    }

    if (block == Block.SANDSTONE) {
        return true;
    }

    // TODO: add red sandstone case in Minecraft 1.8
    return block == Block.SNOW;

}
 
Example 5
Source File: PopulatorSugarcane.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
private boolean findWater(int x, int y, int z) {
    int count = 0;
    for (int i = x - 4; i < (x + 4); i++) {
        for (int j = z - 4; j < (z + 4); j++) {
            int b = this.level.getBlockIdAt(i, y, j);
            if (b == Block.WATER || b == Block.STILL_WATER) {
                count++;
            }
            if (count > 10) {
                return true;
            }
        }
    }
    return (count > 10);
}
 
Example 6
Source File: PopulatorLilyPad.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
private boolean canLilyPadStay(int x, int y, int z) {
    int b = this.level.getBlockIdAt(x, y, z);
    return (b == Block.AIR || b == Block.SNOW_LAYER) && this.level.getBlockIdAt(x, y - 1, z) == Block.STILL_WATER;
}
 
Example 7
Source File: PopulatorLilyPad.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
private boolean canLilyPadStay(int x, int y, int z) {
    int b = this.level.getBlockIdAt(x, y, z);
    return (b == Block.AIR || b == Block.SNOW_LAYER) && this.level.getBlockIdAt(x, y - 1, z) == Block.STILL_WATER;
}