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;
}
Aggregations