mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-05-27 22:04:39 +00:00
chore: format Minecraft.World
This commit is contained in:
@@ -10,66 +10,57 @@ const std::wstring CustomPayloadPacket::CUSTOM_BOOK_SIGN_PACKET = L"MC|BSign";
|
||||
const std::wstring CustomPayloadPacket::TEXTURE_PACK_PACKET = L"MC|TPack";
|
||||
const std::wstring CustomPayloadPacket::TRADER_LIST_PACKET = L"MC|TrList";
|
||||
const std::wstring CustomPayloadPacket::TRADER_SELECTION_PACKET = L"MC|TrSel";
|
||||
const std::wstring CustomPayloadPacket::SET_ADVENTURE_COMMAND_PACKET = L"MC|AdvCdm";
|
||||
const std::wstring CustomPayloadPacket::SET_ADVENTURE_COMMAND_PACKET =
|
||||
L"MC|AdvCdm";
|
||||
const std::wstring CustomPayloadPacket::SET_BEACON_PACKET = L"MC|Beacon";
|
||||
const std::wstring CustomPayloadPacket::SET_ITEM_NAME_PACKET = L"MC|ItemName";
|
||||
|
||||
CustomPayloadPacket::CustomPayloadPacket()
|
||||
{
|
||||
}
|
||||
CustomPayloadPacket::CustomPayloadPacket() {}
|
||||
|
||||
CustomPayloadPacket::CustomPayloadPacket(const std::wstring &identifier, byteArray data)
|
||||
{
|
||||
this->identifier = identifier;
|
||||
this->data = data;
|
||||
CustomPayloadPacket::CustomPayloadPacket(const std::wstring& identifier,
|
||||
byteArray data) {
|
||||
this->identifier = identifier;
|
||||
this->data = data;
|
||||
|
||||
if (data.data != NULL)
|
||||
{
|
||||
length = data.length;
|
||||
if (data.data != NULL) {
|
||||
length = data.length;
|
||||
|
||||
if (length > Short::MAX_VALUE)
|
||||
{
|
||||
app.DebugPrintf("Payload may not be larger than 32K\n");
|
||||
if (length > Short::MAX_VALUE) {
|
||||
app.DebugPrintf("Payload may not be larger than 32K\n");
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
__debugbreak();
|
||||
__debugbreak();
|
||||
#endif
|
||||
//throw new IllegalArgumentException("Payload may not be larger than 32k");
|
||||
}
|
||||
}
|
||||
// throw new IllegalArgumentException("Payload may not be larger
|
||||
// than 32k");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CustomPayloadPacket::read(DataInputStream *dis)
|
||||
{
|
||||
identifier = readUtf(dis, 20);
|
||||
length = dis->readShort();
|
||||
void CustomPayloadPacket::read(DataInputStream* dis) {
|
||||
identifier = readUtf(dis, 20);
|
||||
length = dis->readShort();
|
||||
|
||||
if (length > 0 && length < Short::MAX_VALUE)
|
||||
{
|
||||
if(data.data != NULL)
|
||||
{
|
||||
delete [] data.data;
|
||||
}
|
||||
data = byteArray(length);
|
||||
dis->readFully(data);
|
||||
}
|
||||
if (length > 0 && length < Short::MAX_VALUE) {
|
||||
if (data.data != NULL) {
|
||||
delete[] data.data;
|
||||
}
|
||||
data = byteArray(length);
|
||||
dis->readFully(data);
|
||||
}
|
||||
}
|
||||
|
||||
void CustomPayloadPacket::write(DataOutputStream *dos)
|
||||
{
|
||||
writeUtf(identifier, dos);
|
||||
dos->writeShort((short) length);
|
||||
if (data.data != NULL)
|
||||
{
|
||||
dos->write(data);
|
||||
}
|
||||
void CustomPayloadPacket::write(DataOutputStream* dos) {
|
||||
writeUtf(identifier, dos);
|
||||
dos->writeShort((short)length);
|
||||
if (data.data != NULL) {
|
||||
dos->write(data);
|
||||
}
|
||||
}
|
||||
|
||||
void CustomPayloadPacket::handle(PacketListener *listener)
|
||||
{
|
||||
listener->handleCustomPayload( shared_from_this() );
|
||||
void CustomPayloadPacket::handle(PacketListener* listener) {
|
||||
listener->handleCustomPayload(shared_from_this());
|
||||
}
|
||||
|
||||
int CustomPayloadPacket::getEstimatedSize()
|
||||
{
|
||||
return 2 + identifier.length() * 2 + 2 + length;
|
||||
int CustomPayloadPacket::getEstimatedSize() {
|
||||
return 2 + identifier.length() * 2 + 2 + length;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user