January 28, 20179 yr Hi! am making a progressive miner.. but can't figure out the enums. Got this so far: Quote @Override public boolean canProcess() { return api.skills.getStatic(Skill.MINING) < 15 && !(api.skills.getStatic(Skill.MINING) > 15) && !api.myPlayer().isAnimating() && !api.myPlayer().isMoving() && !api.getInventory().isFull() && proMiner.lumbridgeRocks.contains(api.myPlayer()); } @Override public void process(){ if (Rock.TIN != null) api.getObjects().closest("Rock").interact("Mine"); and the main class where enums are shown as Quote public RS2Object tinRock = getRockWithOre(Rock.TIN); ArrayList<Task> tasks = new ArrayList<Task>(); public enum Rock { CLAY(6705), COPPER(4645), TIN(53), IRON(2576), SILVER(74), COAL(10508), GOLD(8885), MITHRIL(-22239), ADAMANTITE(21662), RUNITE(-31437); final short COLOUR; Rock(final int COLOUR) { this.COLOUR = (short) COLOUR; } } @SuppressWarnings("unchecked") public RS2Object getRockWithOre(Rock rock){ return getObjects().closest(obj -> { short[] colours = obj.getDefinition().getModifiedModelColors(); if(colours != null){ for(short c : colours){ if(c == rock.COLOUR) return true; } } return false; }); } How should I get it to either mine tin or copper? As currently code isn't finished but can't workout it using RS2Object? Thanks
January 28, 20179 yr Just now, Montana of 300 said: public RS2Object getRockWithOre(Rock rock){ return getObjects().closest(obj -> { short[] colours = obj.getDefinition().getModifiedModelColors(); if(colours != null){ for(short c : colours){ if(c == rock.COLOUR) return true; } } return false; }); You already have that method public RS2Object getRockWithOre(Rock rock){ return getObjects().closest(obj -> { short[] colours = obj.getDefinition().getModifiedModelColors(); if(colours != null){ for(short c : colours){ if(c == rock.COLOUR) return true; } } return false; }); Use it as: getRockWithOre(Rock.TIN);
January 28, 20179 yr Author I also haven't classed @getRockWithOre properly.. how should I do this? public RS2Object tinRock = getRockWithOre(Rock.TIN); That atm?
January 28, 20179 yr Paste this in the Task: public RS2Object tinRock = getRockWithOre(Rock.TIN); if(tinRock != null){ }
January 28, 20179 yr 1 minute ago, Montana of 300 said: I also haven't classed @getRockWithOre properly.. how should I do this? public RS2Object tinRock = getRockWithOre(Rock.TIN); That atm? Please refer to the post i made before this and let me know if any problems.
January 28, 20179 yr I have updated the post where I assume you got this snippet from: http://osbot.org/forum/topic/88389-mining-rocks-with-ore-no-ids/ You can just put the Rock enum in it's own file called Rock.java The usage is also on the thread.