Fix visual = "wielditem" compatibility with MT 0.4.15
MT 0.4.15 is only able to interpret the item name, if an item count or metadata is sent in textures then MT 0.4.15 and older would show the item as an unknown item.
This commit is contained in:
parent
635e2893ad
commit
a7d881cb10
@ -159,7 +159,14 @@ void ObjectProperties::serialize(std::ostream &os, u16 protocol_version) const
|
|||||||
if (protocol_version < 37 && (visual == "item" || visual == "wielditem") &&
|
if (protocol_version < 37 && (visual == "item" || visual == "wielditem") &&
|
||||||
!wield_item.empty()) {
|
!wield_item.empty()) {
|
||||||
writeU16(os, 1);
|
writeU16(os, 1);
|
||||||
os << serializeString16(wield_item);
|
// MT 0.4.15 and below only expect the item name, if anything else
|
||||||
|
// (such as an item count or metadata) is sent then older clients will
|
||||||
|
// show the object as an unknown item.
|
||||||
|
const size_t pos = wield_item.find(' ');
|
||||||
|
if (pos == std::string::npos)
|
||||||
|
os << serializeString16(wield_item);
|
||||||
|
else
|
||||||
|
os << serializeString16(wield_item.substr(0, pos));
|
||||||
} else {
|
} else {
|
||||||
writeU16(os, textures.size());
|
writeU16(os, textures.size());
|
||||||
for (const std::string &texture : textures) {
|
for (const std::string &texture : textures) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user