]> git.lizzy.rs Git - minetest.git/commitdiff
Rename hash field to _hash and document it properly itemmeta_restrictions
authorElias Fleckenstein <eliasfleckenstein@web.de>
Tue, 9 Mar 2021 09:27:57 +0000 (10:27 +0100)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Tue, 9 Mar 2021 09:27:57 +0000 (10:27 +0100)
doc/lua_api.txt
src/itemstackmetadata.cpp

index d3165b9fd6008eea8c3731893a25c19ddca6702c..cb2f685e237eb12694c0e4c91212ecb388a28d33 100644 (file)
@@ -2040,6 +2040,12 @@ Some of the values in the key-value store are handled specially:
 * `palette_index`: If the item has a palette, this is used to get the
   current color from the palette.
 
+Item metadata is usually not fully sent to client (except the client has
+local map saving enabled or it is disabled globaly by the server). Only
+the fields `description`, `short_description`, `color`, `palette_index`
+and `tool_capabilities` are always sent. If there are any other fields,
+they will be hashed into an additional `_hash` field.
+
 Example:
 
     local meta = stack:get_meta()
index 048dd9eec5075cdfd80e04d9da570bbe5136a907..d10760af2d4969d162b8cb7612dace63bf2d0973 100644 (file)
@@ -78,7 +78,7 @@ void ItemStackMetadata::serialize(std::ostream &os, InventoryOptimizationOption
        }
        std::string hash_str = os_hash.str();
        if (! hash_str.empty()) {
-               os2 << "hash" << DESERIALIZE_KV_DELIM
+               os2 << "_hash" << DESERIALIZE_KV_DELIM
                        << murmur_hash_64_ua(hash_str.data(), hash_str.length(), 0xdeadbeef) << DESERIALIZE_PAIR_DELIM;
        }
        os << serializeJsonStringIfNeeded(os2.str());