Very good tutorial and code!
Little suggestion to add for tutorial, allow bot to only mine rocks which it can depending on level.
Get rock to mine.
GameObject rockToMine = getGameObjects().closest(new Filter<GameObject>() {
@Override
public boolean match(GameObject rock) {
return rock != null && rock.hasAction("Mine") &&
rock.getName().contains("Rocks") &&
rock.getModelColors() != null &&
Rock.getAllowedRocksByLevel(getSkills().getRealLevel(Skill.MINING)).
anyMatch(rockEnum -> contains(rock.getModelColors(), rockEnum.getColour()));
}
});
And then do filtering for colors in Rock enum.
public static Stream<Rock> getAllowedRocksByLevel(int level) {
return Rock.stream()
.filter(p -> p.getLevel() <= level);
}
I wrote this bot code yesterday so please give some feedback about it
Rock.java
MinerNode.java