Skip to content

Commit

Permalink
Remove .RemoveLastPlus() from spawn entity packets
Browse files Browse the repository at this point in the history
This is unnecessary for players since we don't show + at end of player names anyways
  • Loading branch information
UnknownShadow200 committed Dec 20, 2020
1 parent 6e53033 commit 43024d0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions MCGalaxy/Network/Packets/Packet.cs
Expand Up @@ -68,7 +68,7 @@ public static class Packet {
byte[] buffer = new byte[74 + (extPos ? 6 : 0)];
buffer[0] = Opcode.AddEntity;
buffer[1] = entityID;
NetUtils.Write(name.RemoveLastPlus(), buffer, 2, hasCP437);
NetUtils.Write(name, buffer, 2, hasCP437);

int offset = NetUtils.WritePos(pos, buffer, 66, extPos);
buffer[66 + offset] = rot.RotY;
Expand Down Expand Up @@ -170,12 +170,12 @@ public static class Packet {
return buffer;
}

public static byte[] ExtAddEntity(byte entityID, string name, string displayname, bool hasCP437) {
public static byte[] ExtAddEntity(byte entityID, string skin, string name, bool hasCP437) {
byte[] buffer = new byte[130];
buffer[0] = Opcode.CpeExtAddEntity;
buffer[1] = entityID;
NetUtils.Write(name, buffer, 2, hasCP437);
NetUtils.Write(displayname, buffer, 66, hasCP437);
NetUtils.Write(skin, buffer, 2, hasCP437);
NetUtils.Write(name, buffer, 66, hasCP437);
return buffer;
}

Expand Down Expand Up @@ -309,8 +309,8 @@ public static class Packet {
byte[] buffer = new byte[138 + (extPos ? 6 : 0)];
buffer[0] = Opcode.CpeExtAddEntity2;
buffer[1] = entityID;
NetUtils.Write(displayName.RemoveLastPlus(), buffer, 2, hasCP437);
NetUtils.Write(skinName.RemoveLastPlus(), buffer, 66, hasCP437);
NetUtils.Write(displayName, buffer, 2, hasCP437);
NetUtils.Write(skinName, buffer, 66, hasCP437);

int offset = NetUtils.WritePos(pos, buffer, 130, extPos);
buffer[130 + offset] = rot.RotY;
Expand Down

0 comments on commit 43024d0

Please sign in to comment.