示例#1
0
        public BlockState Get(uint id)
        {
            if (IdToState.TryGetValue(id, out BlockState state))
            {
                return(state);
            }

            return(null);
        }
示例#2
0
        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);
        }