fix: исправлена ошибка null exception у стейтов
This commit is contained in:
@@ -79,9 +79,10 @@ public class BlockStateRegisters {
|
|||||||
return states;
|
return states;
|
||||||
} // [state1, value1, state2, value2, ...]
|
} // [state1, value1, state2, value2, ...]
|
||||||
public static int runtimeIdByStates(int id, int[] statesAndValues){
|
public static int runtimeIdByStates(int id, int[] statesAndValues){
|
||||||
Map<String, Integer> state = new HashMap<>();
|
final Map<String, Integer> state = new HashMap<>();
|
||||||
for(int i = 0;i < statesAndValues.length;i+=2)
|
for(int i = 0;i < statesAndValues.length;i+=2)
|
||||||
state.put(nameByStateId.get(statesAndValues[i]), statesAndValues[i+1]);
|
state.put(nameByStateId.get(statesAndValues[i]), statesAndValues[i+1]);
|
||||||
return runtimeIdsForStatesAndId.get(id).get(state);
|
final Integer res = runtimeIdsForStatesAndId.get(id).get(state);
|
||||||
|
return res == null ? -1 : res;
|
||||||
}// -1 is returned in case it is not found
|
}// -1 is returned in case it is not found
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user