Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static final Thread bitTracker = new Thread(new Runnable(){
- List<Integer> bitsToIgnore = new ArrayList<Integer>(Arrays.asList(4101,4118,4132,4606,8354,5983));
- @Override
- public void run() {
- int[] cachedBitValues = new int[16000];
- for(int i=0;i<cachedBitValues.length;i++){
- cachedBitValues[i] = getBitValue(i);
- }
- while(true){
- General.sleep(500);
- for(int i=0;i<cachedBitValues.length;i++){
- int currentValue = getBitValue(i);
- int knownValue = cachedBitValues[i];
- if(currentValue!=knownValue && !bitsToIgnore.contains(i)){
- General.println("VarBit: " + i + ": " + knownValue + " -> " + currentValue);
- cachedBitValues[i] = currentValue;
- }
- }
- }
- }
- private int getBitValue(int id){
- RSVarBit bit = RSVarBit.get(id);
- return bit != null ? bit.getValue() : -1;
- }
- });
- public class RSVarBit {
- private final CacheVarbitConfig config;
- private RSVarBit(int id){
- this.config = CacheVarbitConfig.load(id);
- }
- public int getValue(){
- int varpsValue = Varpbits.varpbit(this.config.getConfigId());
- int startBit = this.config.getStartBit(), endBit = this.config.getEndBit();
- return (varpsValue << (31 - endBit)) >>> (31 - endBit + startBit);
- }
- public static RSVarBit get(int id){
- return new RSVarBit(id);
- }
- public CacheVarbitConfig getConfig(){
- return this.config;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement