summaryrefslogtreecommitdiffstats
path: root/src/Protocol
diff options
context:
space:
mode:
authorbibo38 <bibo38@github.com>2015-07-13 22:25:40 +0200
committerbibo38 <bibo38@github.com>2015-07-15 19:32:10 +0200
commitd364b779d1eb3be44c7599172dd349027aef6f1f (patch)
tree5cd9518f74046d23373d75e90e52405d6760110c /src/Protocol
parentMerge pull request #2330 from cuberite/libraryupdate (diff)
downloadcuberite-d364b779d1eb3be44c7599172dd349027aef6f1f.tar
cuberite-d364b779d1eb3be44c7599172dd349027aef6f1f.tar.gz
cuberite-d364b779d1eb3be44c7599172dd349027aef6f1f.tar.bz2
cuberite-d364b779d1eb3be44c7599172dd349027aef6f1f.tar.lz
cuberite-d364b779d1eb3be44c7599172dd349027aef6f1f.tar.xz
cuberite-d364b779d1eb3be44c7599172dd349027aef6f1f.tar.zst
cuberite-d364b779d1eb3be44c7599172dd349027aef6f1f.zip
Diffstat (limited to '')
-rw-r--r--src/Protocol/Protocol17x.cpp22
-rw-r--r--src/Protocol/Protocol18x.cpp15
2 files changed, 27 insertions, 10 deletions
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp
index c5c0f4a03..53bb01790 100644
--- a/src/Protocol/Protocol17x.cpp
+++ b/src/Protocol/Protocol17x.cpp
@@ -3015,6 +3015,19 @@ void cProtocol172::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_En
void cProtocol172::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob)
{
+ // Living Enitiy Metadata
+ if (a_Mob.HasCustomName())
+ {
+ a_Pkt.WriteBEUInt8(0x8a);
+ a_Pkt.WriteString(a_Mob.GetCustomName());
+
+ a_Pkt.WriteBEUInt8(0x0b);
+ a_Pkt.WriteBool(a_Mob.IsCustomNameAlwaysVisible());
+ }
+
+ a_Pkt.WriteBEUInt8(0x66);
+ a_Pkt.WriteBEFloat(a_Mob.GetHealth());
+
switch (a_Mob.GetMobType())
{
case mtBat:
@@ -3208,15 +3221,6 @@ void cProtocol172::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob)
break;
}
} // switch (a_Mob.GetType())
-
- // Custom name:
- if (a_Mob.HasCustomName())
- {
- a_Pkt.WriteBEUInt8(0x8a);
- a_Pkt.WriteString(a_Mob.GetCustomName());
- a_Pkt.WriteBEUInt8(0x0b);
- a_Pkt.WriteBEUInt8(a_Mob.IsCustomNameAlwaysVisible() ? 1 : 0);
- }
}
diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol18x.cpp
index 99bba63e3..63fa91b01 100644
--- a/src/Protocol/Protocol18x.cpp
+++ b/src/Protocol/Protocol18x.cpp
@@ -3226,7 +3226,7 @@ void cProtocol180::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_En
}
a_Pkt.WriteBEUInt8(0); // Byte(0) + index 0
a_Pkt.WriteBEUInt8(Flags);
-
+
switch (a_Entity.GetEntityType())
{
case cEntity::etPlayer: break; // TODO?
@@ -3332,6 +3332,19 @@ void cProtocol180::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_En
void cProtocol180::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob)
{
+ // Living Enitiy Metadata
+ if (a_Mob.HasCustomName())
+ {
+ a_Pkt.WriteBEUInt8(0x82);
+ a_Pkt.WriteString(a_Mob.GetCustomName());
+
+ a_Pkt.WriteBEUInt8(0x03);
+ a_Pkt.WriteBool(a_Mob.IsCustomNameAlwaysVisible());
+ }
+
+ a_Pkt.WriteBEUInt8(0x66);
+ a_Pkt.WriteBEFloat(a_Mob.GetHealth());
+
switch (a_Mob.GetMobType())
{
case mtBat: