Added support for protocol 1.12 (#3757)
This commit is contained in:
parent
4dc72fe00b
commit
5a228fbc16
@ -11,6 +11,7 @@ SET (SRCS
|
||||
Protocol_1_9.cpp
|
||||
Protocol_1_10.cpp
|
||||
Protocol_1_11.cpp
|
||||
Protocol_1_12.cpp
|
||||
ProtocolRecognizer.cpp
|
||||
)
|
||||
|
||||
@ -24,6 +25,7 @@ SET (HDRS
|
||||
Protocol_1_9.h
|
||||
Protocol_1_10.h
|
||||
Protocol_1_11.h
|
||||
Protocol_1_12.h
|
||||
ProtocolRecognizer.h
|
||||
)
|
||||
|
||||
@ -32,6 +34,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set_source_files_properties(Protocol_1_8.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch")
|
||||
set_source_files_properties(Protocol_1_10.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch")
|
||||
set_source_files_properties(Protocol_1_11.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch")
|
||||
set_source_files_properties(Protocol_1_12.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch")
|
||||
endif()
|
||||
|
||||
if (NOT MSVC)
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "Protocol_1_9.h"
|
||||
#include "Protocol_1_10.h"
|
||||
#include "Protocol_1_11.h"
|
||||
#include "Protocol_1_12.h"
|
||||
#include "Packetizer.h"
|
||||
#include "../ClientHandle.h"
|
||||
#include "../Root.h"
|
||||
@ -57,6 +58,7 @@ AString cProtocolRecognizer::GetVersionTextFromInt(int a_ProtocolVersion)
|
||||
case PROTO_VERSION_1_10_0: return "1.10";
|
||||
case PROTO_VERSION_1_11_0: return "1.11";
|
||||
case PROTO_VERSION_1_11_1: return "1.11.1";
|
||||
case PROTO_VERSION_1_12: return "1.12";
|
||||
}
|
||||
ASSERT(!"Unknown protocol version");
|
||||
return Printf("Unknown protocol (%d)", a_ProtocolVersion);
|
||||
@ -1085,6 +1087,11 @@ bool cProtocolRecognizer::TryRecognizeLengthedProtocol(UInt32 a_PacketLengthRema
|
||||
m_Protocol = new cProtocol_1_11_1(m_Client, ServerAddress, ServerPort, NextState);
|
||||
return true;
|
||||
}
|
||||
case PROTO_VERSION_1_12:
|
||||
{
|
||||
m_Protocol = new cProtocol_1_12(m_Client, ServerAddress, ServerPort, NextState);
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
{
|
||||
LOGD("Client \"%s\" uses an unsupported protocol (lengthed, version %u (0x%x))",
|
||||
|
@ -18,9 +18,9 @@
|
||||
|
||||
|
||||
// Adjust these if a new protocol is added or an old one is removed:
|
||||
#define MCS_CLIENT_VERSIONS "1.8.x, 1.9.x, 1.10.x, 1.11.x"
|
||||
#define MCS_PROTOCOL_VERSIONS "47, 107, 108, 109, 110, 210, 315, 316"
|
||||
#define MCS_LATEST_PROTOCOL_VERSION 316
|
||||
#define MCS_CLIENT_VERSIONS "1.8.x, 1.9.x, 1.10.x, 1.11.x, 1.12"
|
||||
#define MCS_PROTOCOL_VERSIONS "47, 107, 108, 109, 110, 210, 315, 316, 335"
|
||||
#define MCS_LATEST_PROTOCOL_VERSION 335
|
||||
|
||||
|
||||
|
||||
@ -42,6 +42,7 @@ public:
|
||||
PROTO_VERSION_1_10_0 = 210,
|
||||
PROTO_VERSION_1_11_0 = 315,
|
||||
PROTO_VERSION_1_11_1 = 316,
|
||||
PROTO_VERSION_1_12 = 335,
|
||||
} ;
|
||||
|
||||
cProtocolRecognizer(cClientHandle * a_Client);
|
||||
|
1509
src/Protocol/Protocol_1_12.cpp
Normal file
1509
src/Protocol/Protocol_1_12.cpp
Normal file
File diff suppressed because it is too large
Load Diff
66
src/Protocol/Protocol_1_12.h
Normal file
66
src/Protocol/Protocol_1_12.h
Normal file
@ -0,0 +1,66 @@
|
||||
|
||||
// Protocol_1_12.h
|
||||
|
||||
/*
|
||||
Declares the 1.12 protocol classes:
|
||||
- cProtocol_1_12
|
||||
- release 1.12 protocol (#335)
|
||||
(others may be added later in the future for the 1.12 release series)
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Protocol_1_11.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class cProtocol_1_12 :
|
||||
public cProtocol_1_11_1
|
||||
{
|
||||
typedef cProtocol_1_11_1 super;
|
||||
|
||||
public:
|
||||
cProtocol_1_12(cClientHandle * a_Client, const AString &a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State);
|
||||
|
||||
virtual void SendAttachEntity(const cEntity & a_Entity, const cEntity & a_Vehicle) override;
|
||||
virtual void SendCameraSetTo(const cEntity & a_Entity) override;
|
||||
virtual void SendCollectEntity(const cEntity & a_Entity, const cPlayer & a_Player, int a_Count) override;
|
||||
virtual void SendDestroyEntity(const cEntity & a_Entity) override;
|
||||
virtual void SendDetachEntity(const cEntity & a_Entity, const cEntity & a_PreviousVehicle);
|
||||
virtual void SendDisplayObjective(const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) override;
|
||||
virtual void SendEntityEffect(const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration) override;
|
||||
virtual void SendEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override;
|
||||
virtual void SendEntityHeadLook(const cEntity & a_Entity) override;
|
||||
virtual void SendEntityLook(const cEntity & a_Entity) override;
|
||||
virtual void SendEntityMetadata(const cEntity & a_Entity) override;
|
||||
virtual void SendEntityProperties(const cEntity & a_Entity) override;
|
||||
virtual void SendEntityRelMove(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ)override;
|
||||
virtual void SendEntityRelMoveLook(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ)override;
|
||||
virtual void SendEntityVelocity(const cEntity & a_Entity) override;
|
||||
virtual void SendExperience(void) override;
|
||||
virtual void SendHealth(void) override;
|
||||
virtual void SendHideTitle(void) override;
|
||||
virtual void SendLogin(const cPlayer & a_Player, const cWorld & a_World) override;
|
||||
virtual void SendPlayerMaxSpeed(void) override;
|
||||
virtual void SendRemoveEntityEffect(const cEntity & a_Entity, int a_EffectID) override;
|
||||
virtual void SendResetTitle(void) override;
|
||||
virtual void SendRespawn(eDimension a_Dimension) override;
|
||||
virtual void SendScoreUpdate(const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) override;
|
||||
virtual void SendScoreboardObjective(const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override;
|
||||
virtual void SendSpawnMob(const cMonster & a_Mob) override;
|
||||
virtual void SendTeleportEntity(const cEntity & a_Entity) override;
|
||||
virtual void SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) override;
|
||||
virtual void SendTitleTimes(int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) override;
|
||||
protected:
|
||||
virtual bool HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType) override;
|
||||
virtual void HandlePacketBlockPlace(cByteBuffer & a_ByteBuffer) override;
|
||||
virtual void HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) override;
|
||||
virtual void WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_Entity) override;
|
||||
virtual void WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob) override;
|
||||
};
|
Loading…
Reference in New Issue
Block a user