Advertisement
Guest User

Config -- Compost

a guest
Nov 1st, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. public static final int
  2. CAMMY = 7837,
  3. FALLY = 7836,
  4. ARDY = 7839,
  5. PORTP = 7838
  6. ;
  7. private final int config = 511;
  8. private final String name = "Compost Bin";
  9.  
  10. public int getNthByte(int n, int packed)
  11. {
  12. int shifted = packed >> (8 * n);
  13. int masked = 0x000000FF & shifted;
  14. return masked;
  15. }
  16.  
  17. public FarmingState getState()
  18. {
  19. int posNum = -1;
  20. switch(myLocation)
  21. {
  22. case FarmingLocations.ARDY:
  23. posNum = 3;
  24. break;
  25. case FarmingLocations.PORT_P:
  26. posNum = 2;
  27. break;
  28. case FarmingLocations.CAMMY:
  29. posNum = 1;
  30. break;
  31. case FarmingLocations.FALLY:
  32. posNum = 0;
  33. break;
  34. default:
  35. posNum = -1;
  36. break;
  37. }
  38. if(posNum == -1)
  39. return null;
  40. switch(Integer.parseInt(Integer.toBinaryString(getNthByte(posNum, Game.getSetting(config))), 2))
  41. {
  42. case 0:
  43. return FarmingState.EMPTY;
  44. case 1:
  45. case 2:
  46. case 3:
  47. case 4:
  48. case 5:
  49. case 6:
  50. case 7:
  51. case 8:
  52. case 9:
  53. case 10:
  54. case 11:
  55. case 12:
  56. case 13:
  57. case 14:
  58. return FarmingState.WEEDS_ADDED;
  59. case 15:
  60. return FarmingState.READY_TO_CLOSE;
  61. case 16:
  62. case 17:
  63. case 18:
  64. case 19:
  65. case 20:
  66. case 21:
  67. case 22:
  68. case 23:
  69. case 24:
  70. case 25:
  71. case 26:
  72. case 27:
  73. case 28:
  74. case 29:
  75. case 30:
  76. return FarmingState.COMPOST_LEFT;
  77. case 31:
  78. return FarmingState.STAGE_1_DECOMP;
  79. case 32:
  80. return FarmingState.STAGE_2_DECOMP;
  81. case 94:
  82. return FarmingState.READY_TO_OPEN;
  83. default:
  84. return FarmingState.STAGE_X_DECOMP;
  85. }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement