This is what I have come up with
two_ore_spawn area
private Area two_ore_spawn = new Area(3175, 3366, 3175, 3368);
private boolean newRock;
//If we stopped animating OR newRock is TRUE
if (!myPlayer().isAnimating() || newRock){
//Object filter for: hasOre AND inside the specified area
RS2Object rock = getObjects().closest(obj -> Rock.IRON.hasOre(obj) && two_ore_spawn.contains(obj.getPosition()));
//If rock type exists && we clicked it
if (rock != null && rock.interact("Mine")){
//Set newRock to FALSE if we have just clicked it!
newRock = false;
log("Clicked on: " + rock.getName() + " " + rock.getPosition());
//Sleep until condition evaluates to true for 5 seconds and looping the condition every 1.5 seconds
if (new ConditionalSleep(5000, 1500) {
@Override
public boolean condition() throws InterruptedException {
return !rock.exists();
}
}.sleep()){
log("Conditional sleep evaluated to true!");
//If the conditional sleep evaluated true then we set newRock to TRUE
newRock = true;
}
}
}
Explv's Snippet Data
import org.osbot.rs07.api.model.Entity;
public enum Rock {
CLAY(new short[]{6705}),
COPPER(new short[]{4645, 4510}),
TIN(new short[]{53}),
IRON(new short[]{2576}),
SILVER(new short[]{74}),
COAL(new short[]{10508}),
GOLD(new short[]{8885}),
MITHRIL(new short[]{-22239}),
ADAMANTITE(new short[]{21662}),
RUNITE(new short[]{-31437});
private short[] colours;
Rock(final short[] colours) {
this.colours = colours;
}
public boolean hasOre(final Entity rockEntity) {
if (rockEntity.getDefinition() == null) {
return false;
}
short[] colours = rockEntity.getDefinition().getModifiedModelColors();
if (colours == null) {
return false;
}
for (short rockColour : this.colours) {
for (short entityColour : colours) {
if (rockColour == entityColour) {
return true;
}
}
}
return false;
}
}