Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static final int
- CAMMY = 7837,
- FALLY = 7836,
- ARDY = 7839,
- PORTP = 7838
- ;
- private final int config = 511;
- private final String name = "Compost Bin";
- public int getNthByte(int n, int packed)
- {
- int shifted = packed >> (8 * n);
- int masked = 0x000000FF & shifted;
- return masked;
- }
- public FarmingState getState()
- {
- int posNum = -1;
- switch(myLocation)
- {
- case FarmingLocations.ARDY:
- posNum = 3;
- break;
- case FarmingLocations.PORT_P:
- posNum = 2;
- break;
- case FarmingLocations.CAMMY:
- posNum = 1;
- break;
- case FarmingLocations.FALLY:
- posNum = 0;
- break;
- default:
- posNum = -1;
- break;
- }
- if(posNum == -1)
- return null;
- switch(Integer.parseInt(Integer.toBinaryString(getNthByte(posNum, Game.getSetting(config))), 2))
- {
- case 0:
- return FarmingState.EMPTY;
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- case 10:
- case 11:
- case 12:
- case 13:
- case 14:
- return FarmingState.WEEDS_ADDED;
- case 15:
- return FarmingState.READY_TO_CLOSE;
- case 16:
- case 17:
- case 18:
- case 19:
- case 20:
- case 21:
- case 22:
- case 23:
- case 24:
- case 25:
- case 26:
- case 27:
- case 28:
- case 29:
- case 30:
- return FarmingState.COMPOST_LEFT;
- case 31:
- return FarmingState.STAGE_1_DECOMP;
- case 32:
- return FarmingState.STAGE_2_DECOMP;
- case 94:
- return FarmingState.READY_TO_OPEN;
- default:
- return FarmingState.STAGE_X_DECOMP;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement