Advertisement
Guest User

Untitled

a guest
Dec 4th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. package main;
  2.  
  3. import java.awt.AlphaComposite;
  4. import java.awt.Color;
  5. import java.awt.Graphics2D;
  6. import java.awt.Polygon;
  7.  
  8. import org.osbot.rs07.script.Script;
  9. import org.osbot.rs07.script.ScriptManifest;
  10.  
  11. @ScriptManifest(author = "", info = "", logo = "", name = "TreeCutterScript", version = 0)
  12. public class TreeCutterScript extends Script {
  13. private Woodcutting woodcutting;
  14.  
  15. @Override
  16. public void onStart() throws InterruptedException {
  17.  
  18. }
  19.  
  20. @Override
  21. public int onLoop() throws InterruptedException {
  22. return 300;
  23. }
  24.  
  25. @Override
  26. public void onPaint(Graphics2D g) {
  27. g.setComposite(AlphaComposite.SrcOver.derive(0.2f));
  28.  
  29. for (TreeType type : TreeType.values()) {
  30. Color color = getTreeColor(type);
  31. g.setColor(color);
  32. paintTrees(g, type);
  33. }
  34. }
  35.  
  36. private void paintTrees(Graphics2D g, TreeType type) {
  37. for (Tree tree : woodcutting.getAll(type)) {
  38. Polygon polygon = tree.getPosition().getPolygon(bot);
  39. g.setColor(getTreeColor(type));
  40. g.fill(polygon);
  41. }
  42. }
  43.  
  44. private Color getTreeColor(TreeType type) {
  45. switch (type) {
  46. case MAGIC: return Color.BLACK;
  47. case MAPLE: return Color.BLUE;
  48. case NORMAL: return Color.CYAN;
  49. case OAK: return Color.PINK;
  50. case WILLOW: return Color.GREEN;
  51. case YEW: return Color.YELLOW;
  52. default: return Color.WHITE;
  53. }
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement