diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-03-09 10:27:57 +0100 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-03-09 10:27:57 +0100 |
commit | fe97d1b5d3654e17489c589018ea3aaf73af2354 (patch) | |
tree | 03f288fdf057ef52f02c932c9c2bb28a25626025 | |
parent | 88a1a5db9539bb2452e6048ac8f6738fb433e918 (diff) | |
download | minetest-fe97d1b5d3654e17489c589018ea3aaf73af2354.tar.xz |
Rename hash field to _hash and document it properlyitemmeta_restrictions
-rw-r--r-- | doc/lua_api.txt | 6 | ||||
-rw-r--r-- | src/itemstackmetadata.cpp | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt index d3165b9fd..cb2f685e2 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -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() diff --git a/src/itemstackmetadata.cpp b/src/itemstackmetadata.cpp index 048dd9eec..d10760af2 100644 --- a/src/itemstackmetadata.cpp +++ b/src/itemstackmetadata.cpp @@ -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()); |