public BlockState Get(uint id) { if (IdToState.TryGetValue(id, out BlockState state)) { return(state); } return(null); }
public uint Add(BlockState state) { if (StateToId.TryGetValue(state, out var id)) { return(id); } uint newIndex = _available++; StateToId.TryAdd(state, newIndex); IdToState.TryAdd(newIndex, state); return(newIndex); }