Skip to content

Commit

Permalink
VarInt metadata written correctly for boats (cuberite#3709)
Browse files Browse the repository at this point in the history
* Varint metadata written correctly for boats
  • Loading branch information
peterbell10 authored and Seadragon91 committed May 15, 2017
1 parent 86d3244 commit f0a16e6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/Protocol/Protocol_1_10.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,19 +511,19 @@ void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &

a_Pkt.WriteBEInt8(BOAT_LAST_HIT_TIME);
a_Pkt.WriteBEInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteBEInt32(Boat.GetLastDamage());
a_Pkt.WriteVarInt32(static_cast<UInt32>(Boat.GetLastDamage()));

a_Pkt.WriteBEInt8(BOAT_FORWARD_DIRECTION);
a_Pkt.WriteBEInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteBEInt32(Boat.GetForwardDirection());
a_Pkt.WriteVarInt32(static_cast<UInt32>(Boat.GetForwardDirection()));

a_Pkt.WriteBEInt8(BOAT_DAMAGE_TAKEN);
a_Pkt.WriteBEInt8(METADATA_TYPE_FLOAT);
a_Pkt.WriteBEFloat(Boat.GetDamageTaken());

a_Pkt.WriteBEInt8(BOAT_TYPE);
a_Pkt.WriteBEInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteBEInt32(Boat.GetType());
a_Pkt.WriteVarInt32(static_cast<UInt32>(Boat.GetType()));

a_Pkt.WriteBEInt8(BOAT_RIGHT_PADDLE_TURNING);
a_Pkt.WriteBEInt8(METADATA_TYPE_BOOL);
Expand Down
6 changes: 3 additions & 3 deletions src/Protocol/Protocol_1_11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,19 +633,19 @@ void cProtocol_1_11_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &

a_Pkt.WriteBEInt8(BOAT_LAST_HIT_TIME);
a_Pkt.WriteBEInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteBEInt32(Boat.GetLastDamage());
a_Pkt.WriteVarInt32(static_cast<UInt32>(Boat.GetLastDamage()));

a_Pkt.WriteBEInt8(BOAT_FORWARD_DIRECTION);
a_Pkt.WriteBEInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteBEInt32(Boat.GetForwardDirection());
a_Pkt.WriteVarInt32(static_cast<UInt32>(Boat.GetForwardDirection()));

a_Pkt.WriteBEInt8(BOAT_DAMAGE_TAKEN);
a_Pkt.WriteBEInt8(METADATA_TYPE_FLOAT);
a_Pkt.WriteBEFloat(Boat.GetDamageTaken());

a_Pkt.WriteBEInt8(BOAT_TYPE);
a_Pkt.WriteBEInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteBEInt32(Boat.GetType());
a_Pkt.WriteVarInt32(static_cast<UInt32>(Boat.GetType()));

a_Pkt.WriteBEInt8(BOAT_RIGHT_PADDLE_TURNING);
a_Pkt.WriteBEInt8(METADATA_TYPE_BOOL);
Expand Down
6 changes: 3 additions & 3 deletions src/Protocol/Protocol_1_9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3674,19 +3674,19 @@ void cProtocol_1_9_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a

a_Pkt.WriteBEInt8(5); // Index 6: Time since last hit
a_Pkt.WriteBEInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteBEInt32(Boat.GetLastDamage());
a_Pkt.WriteVarInt32(static_cast<UInt32>(Boat.GetLastDamage()));

a_Pkt.WriteBEInt8(6); // Index 7: Forward direction
a_Pkt.WriteBEInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteBEInt32(Boat.GetForwardDirection());
a_Pkt.WriteVarInt32(static_cast<UInt32>(Boat.GetForwardDirection()));

a_Pkt.WriteBEInt8(7); // Index 8: Damage taken
a_Pkt.WriteBEInt8(METADATA_TYPE_FLOAT);
a_Pkt.WriteBEFloat(Boat.GetDamageTaken());

a_Pkt.WriteBEInt8(8); // Index 9: Type
a_Pkt.WriteBEInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteBEInt32(Boat.GetType());
a_Pkt.WriteVarInt32(static_cast<UInt32>(Boat.GetType()));

a_Pkt.WriteBEInt8(9); // Index 10: Right paddle turning
a_Pkt.WriteBEInt8(METADATA_TYPE_BOOL);
Expand Down

0 comments on commit f0a16e6

Please sign in to comment.