Esempio n. 1
0
        public unsafe byte[] Query(Dimension dimension, int chunkX, int chunkZ, DbKeyType dataType)
        {
            EnsureDbIsOpen();

            byte[] key;
            if (dimension.Value == 0) // overworld
            {
                key = new byte[9];
                fixed(byte *pKey = key)
                {
                    key[8]                 = (byte)dataType;
                    *(int *)(pKey)         = chunkX;
                    *(((int *)(pKey)) + 1) = chunkZ;
                }
            }
            else
            {
                key = new byte[13];
                fixed(byte *pKey = key)
                {
                    key[12]                = (byte)dataType;
                    *(int *)(pKey)         = chunkX;
                    *(((int *)(pKey)) + 1) = chunkZ;
                    *(((int *)(pKey)) + 2) = dimension.Value;
                }
            }

            return(db_.Get(key));
        }
Esempio n. 2
0
 public DbKeyDescriptor(int chunkX, int chunkZ, Dimension dimension, DbKeyType keyType)
 {
     ChunkX        = chunkX;
     SubchunkIndex = -1;
     ChunkZ        = chunkZ;
     Dimension     = dimension;
     KeyType       = keyType;
 }
Esempio n. 3
0
 public static bool IsValid(this DbKeyType type)
 {
     return(valid_.Contains(type));
 }