So I accidentally deleted my broken mining script and am trying to re-create it from memory, and so far so good. However I am trying to check the color of the rock before I mine it and I am missing something.
public enum Rock {
CLAY(6705),
COPPER(4645),
TIN(53),
IRON(2576),
SILVER(74),
COAL(10508),
GOLD(8885),
MITHRIL(-22239),
ADAMANTITE(21662),
RUNITE(-31437);
private final short COLOUR;
Rock(final int COLOUR) {
this.COLOUR = (short) COLOUR;
}
public boolean hasOre(final RS2Object object) {
if (object == null || object.getDefinition().getModifiedModelColors() == null || !"Rocks".equals(object.getName())) {
return false;
}
for (final short colour : object.getDefinition().getModifiedModelColors()) {
if (colour == this.COLOUR) {
return true;
}
}
return false;
}
}
public void Minesomething() throws InterruptedException {
goldRock = getObjects().closest( obj -> Rock.GOLD.hasOre(obj));
if (goldRock != null && goldRock.interact("Mine")) {
new Sleep(() -> isAnimating() || !Rock.GOLD.hasOre(goldRock), 10000).sleep();
}
}
That is the code I am having trouble with, It says can not resolve symbol goldRock. And I cant remember how I had it in my original working script. Any pointers?