1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
|
// Protocol_1_14.cpp
/*
Implements the 1.14 protocol classes:
- release 1.14 protocol (#477)
*/
#include "Globals.h"
#include "Protocol_1_14.h"
#include "Packetizer.h"
#include "../Entities/Player.h"
#include "../Root.h"
#include "../Server.h"
#include "../World.h"
#include "Palettes/Upgrade.h"
#include "Palettes/Palette_1_14.h"
////////////////////////////////////////////////////////////////////////////////
// cProtocol_1_14:
void cProtocol_1_14::SendBlockAction(Vector3i a_BlockPos, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType)
{
}
void cProtocol_1_14::SendBlockBreakAnim(UInt32 a_EntityID, Vector3i a_BlockPos, char a_Stage)
{
}
void cProtocol_1_14::SendEditSign(Vector3i a_BlockPos)
{
}
void cProtocol_1_14::SendEntityAnimation(const cEntity & a_Entity, EntityAnimation a_Animation)
{
if (a_Animation == EntityAnimation::PlayerEntersBed)
{
// Use Bed packet removed, through metadata instead:
SendEntityMetadata(a_Entity);
return;
}
Super::SendEntityAnimation(a_Entity, a_Animation);
}
void cProtocol_1_14::SendLogin(const cPlayer & a_Player, const cWorld & a_World)
{
// Send the Join Game packet:
{
cServer * Server = cRoot::Get()->GetServer();
cPacketizer Pkt(*this, pktJoinGame);
Pkt.WriteBEUInt32(a_Player.GetUniqueID());
Pkt.WriteBEUInt8(static_cast<UInt8>(a_Player.GetEffectiveGameMode()) | (Server->IsHardcore() ? 0x08 : 0));
Pkt.WriteBEInt32(static_cast<Int32>(a_World.GetDimension()));
Pkt.WriteBEUInt8(static_cast<UInt8>(Clamp<size_t>(Server->GetMaxPlayers(), 0, 255)));
Pkt.WriteString("default");
Pkt.WriteVarInt32(ToUnsigned(a_World.GetMaxViewDistance()));
Pkt.WriteBool(false);
}
// Send the spawn position:
{
cPacketizer Pkt(*this, pktSpawnPosition);
Pkt.WriteXZYPosition64(a_World.GetSpawnX(), a_World.GetSpawnY(), a_World.GetSpawnZ());
}
// Send the server difficulty:
{
// cPacketizer Pkt(*this, pktDifficulty);
// Pkt.WriteBEInt8(1);
}
}
void cProtocol_1_14::SendPaintingSpawn(const cPainting & a_Painting)
{
}
void cProtocol_1_14::SendSoundParticleEffect(const EffectID a_EffectID, Vector3i a_Origin, int a_Data)
{
}
void cProtocol_1_14::SendUpdateBlockEntity(cBlockEntity & a_BlockEntity)
{
}
void cProtocol_1_14::SendUpdateSign(Vector3i a_BlockPos, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4)
{
}
UInt32 cProtocol_1_14::GetPacketID(ePacketType a_PacketType) const
{
switch (a_PacketType)
{
case cProtocol::pktAttachEntity: return 0x4A;
case cProtocol::pktCameraSetTo: return 0x3E;
case cProtocol::pktCollectEntity: return 0x55;
case cProtocol::pktDestroyEntity: return 0x37;
case cProtocol::pktDisconnectDuringGame: return 0x1A;
case cProtocol::pktEntityEffect: return 0x59;
case cProtocol::pktEntityEquipment: return 0x46;
case cProtocol::pktEntityHeadLook: return 0x3B;
case cProtocol::pktEntityMeta: return 0x43;
case cProtocol::pktEntityProperties: return 0x58;
case cProtocol::pktEntityStatus: return 0x1B;
case cProtocol::pktEntityVelocity: return 0x45;
case cProtocol::pktExperience: return 0x47;
case cProtocol::pktExplosion: return 0x1C;
case cProtocol::pktGameMode: return 0x1E;
case cProtocol::pktHeldItemChange: return 0x3F;
case cProtocol::pktInventorySlot: return 0x16;
case cProtocol::pktKeepAlive: return 0x20;
case cProtocol::pktParticleEffect: return 0x23;
case cProtocol::pktPlayerAbilities: return 0x31;
case cProtocol::pktPlayerList: return 0x33;
case cProtocol::pktPlayerMoveLook: return 0x35;
case cProtocol::pktPluginMessage: return 0x18;
case cProtocol::pktRemoveEntityEffect: return 0x38;
case cProtocol::pktResourcePack: return 0x39;
case cProtocol::pktRespawn: return 0x3A;
case cProtocol::pktScoreboardObjective: return 0x49;
case cProtocol::pktSoundEffect: return 0x19;
case cProtocol::pktSoundParticleEffect: return 0x22;
case cProtocol::pktSpawnPosition: return 0x4D;
case cProtocol::pktTeleportEntity: return 0x56;
case cProtocol::pktTimeUpdate: return 0x4E;
case cProtocol::pktTitle: return 0x4F;
case cProtocol::pktUnloadChunk: return 0x1D;
case cProtocol::pktUnlockRecipe: return 0x36;
case cProtocol::pktUpdateHealth: return 0x48;
case cProtocol::pktUpdateScore: return 0x4C;
case cProtocol::pktUpdateSign: return 0x2F;
case cProtocol::pktWindowItems: return 0x14;
case cProtocol::pktWindowOpen: return 0x2E;
case cProtocol::pktWindowProperty: return 0x15;
default: return Super::GetPacketID(a_PacketType);
}
}
std::pair<short, short> cProtocol_1_14::GetItemFromProtocolID(UInt32 a_ProtocolID) const
{
return PaletteUpgrade::ToItem(Palette_1_14::ToItem(a_ProtocolID));
}
UInt32 cProtocol_1_14::GetProtocolBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta) const
{
return Palette_1_14::From(PaletteUpgrade::FromBlock(a_BlockType, a_Meta));
}
signed char cProtocol_1_14::GetProtocolEntityStatus(EntityAnimation a_Animation) const
{
switch (a_Animation)
{
case EntityAnimation::FoxChews: return 45;
case EntityAnimation::OcelotTrusts: return 40;
case EntityAnimation::OcelotDistrusts: return 41;
case EntityAnimation::PawnBerryBushPricks: return 44;
case EntityAnimation::PawnChestEquipmentBreaks: return 50;
case EntityAnimation::PawnFeetEquipmentBreaks: return 52;
case EntityAnimation::PawnHeadEquipmentBreaks: return 49;
case EntityAnimation::PawnLegsEquipmentBreaks: return 51;
case EntityAnimation::PawnMainHandEquipmentBreaks: return 47;
case EntityAnimation::PawnOffHandEquipmentBreaks: return 48;
case EntityAnimation::PawnTeleports: return 46;
case EntityAnimation::PlayerBadOmenActivates: return 43;
case EntityAnimation::RavagerAttacks: return 4;
case EntityAnimation::RavagerBecomesStunned: return 39;
case EntityAnimation::VillagerSweats: return 42;
default: return Super::GetProtocolEntityStatus(a_Animation);
}
}
UInt32 cProtocol_1_14::GetProtocolItemType(short a_ItemID, short a_ItemDamage) const
{
return Palette_1_14::From(PaletteUpgrade::FromItem(a_ItemID, a_ItemDamage));
}
UInt32 cProtocol_1_14::GetProtocolStatisticType(const CustomStatistic a_Statistic) const
{
return Palette_1_14::From(a_Statistic);
}
cProtocol::Version cProtocol_1_14::GetProtocolVersion() const
{
return Version::v1_14;
}
bool cProtocol_1_14::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType)
{
if (m_State != State::Game)
{
return Super::HandlePacket(a_ByteBuffer, a_PacketType);
}
// Game
switch (a_PacketType)
{
default: a_ByteBuffer.SkipRead(a_ByteBuffer.GetReadableSpace()); a_ByteBuffer.CommitRead(); return true;
}
}
void cProtocol_1_14::HandlePacketBlockDig(cByteBuffer & a_ByteBuffer)
{
}
void cProtocol_1_14::HandlePacketBlockPlace(cByteBuffer & a_ByteBuffer)
{
}
void cProtocol_1_14::HandlePacketUpdateSign(cByteBuffer & a_ByteBuffer)
{
}
|