@Override public void run() { @SuppressWarnings("rawtypes") List entities = null; try { switch (TYPE) { case 0: entities = etc.getServer().getPlayerList(); break; case 1: entities = this.WORLD.getMobList(); break; case 2: entities = this.WORLD.getAnimalList(); break; case 3: entities = this.WORLD.getLivingEntityList(); break; case 4: entities = entitiesExceptPlayers(this.WORLD.getWorld()); break; case 5: entities = entitiesExceptPlayersItems(this.WORLD.getWorld()); break; } } catch (ConcurrentModificationException e) { e.printStackTrace(); return; } if (entities == null) return; boolean found = false; for (Object obj : entities) { BaseEntity entity = (BaseEntity) obj; if (entity.getWorld().getType().getId() != WORLD.getType().getId()) continue; double diffX = BLOCK.getBlockX() - entity.getX(); double diffY = BLOCK.getBlockY() - entity.getY(); double diffZ = BLOCK.getBlockZ() - entity.getZ(); if (diffX * diffX + diffY * diffY + diffZ * diffZ < DISTANCE) { boolean result = entityInRange(entity); if (result) { found = true; if (DESTROY) { entity.destroy(); } else { break; } } } } Redstone.setOutput(CraftBook.getCBWorld(WORLD), LEVER, found); }