Advertisement
FALSkills

Untitled

Nov 21st, 2022
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. public static final Thread bitTracker = new Thread(new Runnable(){
  2. List<Integer> bitsToIgnore = new ArrayList<Integer>(Arrays.asList(4101,4118,4132,4606,8354,5983));
  3.  
  4. @Override
  5. public void run() {
  6. int[] cachedBitValues = new int[16000];
  7. for(int i=0;i<cachedBitValues.length;i++){
  8. cachedBitValues[i] = getBitValue(i);
  9. }
  10. while(true){
  11. General.sleep(500);
  12. for(int i=0;i<cachedBitValues.length;i++){
  13. int currentValue = getBitValue(i);
  14. int knownValue = cachedBitValues[i];
  15. if(currentValue!=knownValue && !bitsToIgnore.contains(i)){
  16. General.println("VarBit: " + i + ": " + knownValue + " -> " + currentValue);
  17. cachedBitValues[i] = currentValue;
  18. }
  19. }
  20. }
  21. }
  22.  
  23. private int getBitValue(int id){
  24. RSVarBit bit = RSVarBit.get(id);
  25. return bit != null ? bit.getValue() : -1;
  26. }
  27.  
  28. });
  29.  
  30. public class RSVarBit {
  31.  
  32. private final CacheVarbitConfig config;
  33.  
  34. private RSVarBit(int id){
  35. this.config = CacheVarbitConfig.load(id);
  36. }
  37.  
  38. public int getValue(){
  39. int varpsValue = Varpbits.varpbit(this.config.getConfigId());
  40. int startBit = this.config.getStartBit(), endBit = this.config.getEndBit();
  41. return (varpsValue << (31 - endBit)) >>> (31 - endBit + startBit);
  42. }
  43.  
  44. public static RSVarBit get(int id){
  45. return new RSVarBit(id);
  46. }
  47.  
  48. public CacheVarbitConfig getConfig(){
  49. return this.config;
  50. }
  51.  
  52.  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement