I will start working to add the 1.8 changes (It's only a nextproject. Enchanting is more important.).
Now i will make the protocol. I will use the 1.7 Protocol and override the new things (like in older protocols. 1.6 or so..).
Okay, my code is shit.
But now i have it. I removed my old question.
Little problem.
Code:
Protocol 1.7: Wrong number of bytes read for packet 0x15, state 3. Read 12 bytes, packet contained 11 bytes
0x15 is the ClientSettings packet or?
void cProtocol180::HandlePacketClientSettings(cByteBuffer & a_ByteBuffer)
{
LOGWARN("Client Settings");
HANDLE_READ(a_ByteBuffer, ReadVarUTF8String, AString, Locale);
HANDLE_READ(a_ByteBuffer, ReadByte, Byte, ViewDistance);
HANDLE_READ(a_ByteBuffer, ReadByte, Byte, ChatFlags);
HANDLE_READ(a_ByteBuffer, ReadByte, Byte, ChatColors);
HANDLE_READ(a_ByteBuffer, ReadByte, Byte, ShowCape);
// TODO: handle in m_Client
}
Without the actual on-wire data, there's very little debugging we can do.
I found the problem.
I use:
void HandlePacketClientSettings(cByteBuffer & a_ByteBuffer);
But i need to override it.
void HandlePacketClientSettings(cByteBuffer & a_ByteBuffer) override;
But this don't work.
Error:
Code:
error C3668: "cProtocol180::HandlePacketClientSettings": The method with override specifier 'override' did not override any base class methods. (Protocol\Protocol18x.cpp)
You need to make it virtual if you want any non-overirden methods to use it. If you dont want to use it in non-overriden methods then you need to remove the override keyword.
Okay. Now i will start working with 14w03a.
The new datatype position is long. So i need a ReadLong and WriteLong in the ByteBuffer.
But i don't know how can i create this. Can someone help me there?
They already exist, there just called readBEInt64 and writeBEInt64
Code:
cPacketizer Pkt(*this, 0x05); // Spawn Position packet
Pkt.WriteLong(((int)a_World.GetSpawnX() & 0x3FFFFFF) << 38 | ((int)a_World.GetSpawnY() & 0xFFF) << 26 | ((int)a_World.GetSpawnZ() & 0x3FFFFFF));
And in the Protocol17x.h:
void WriteLong(long a_Value)
{
m_Out.WriteBEInt64(a_Value);
}
The error from the client is in the attachment.
I think you should instead make a cPacketizer::WritePosition(x, y, z) and inside it compose and write the 64-bit value. I think you're overflowing the arithmetic here, but that's just a wild guess.