Search in sources :

Example 1 with Hopper

use of org.bukkit.block.Hopper in project acidisland by tastybento.

the class Island method getHopperCount.

/**
 * @return number of hoppers on the island
 */
public int getHopperCount() {
    tileEntityCount.clear();
    int result = 0;
    for (int x = getMinProtectedX() / 16; x <= (getMinProtectedX() + getProtectionSize() - 1) / 16; x++) {
        for (int z = getMinProtectedZ() / 16; z <= (getMinProtectedZ() + getProtectionSize() - 1) / 16; z++) {
            for (BlockState holder : world.getChunkAt(x, z).getTileEntities()) {
                if (holder instanceof Hopper && onIsland(holder.getLocation())) {
                    result++;
                }
            }
        }
    }
    return result;
}
Also used : BlockState(org.bukkit.block.BlockState) Hopper(org.bukkit.block.Hopper)

Aggregations

BlockState (org.bukkit.block.BlockState)1 Hopper (org.bukkit.block.Hopper)1