mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-09-23 11:06:34 +00:00
format everything
This commit is contained in:
@@ -486,7 +486,6 @@ void Connection::tick() {
|
||||
// was locking up sometimes when disconnecting
|
||||
for (int i = 0; i < packetsToHandle.size(); i++) {
|
||||
packetsToHandle[i]->handle(packetListener);
|
||||
|
||||
}
|
||||
flush();
|
||||
|
||||
|
||||
@@ -5,9 +5,7 @@
|
||||
#include "java/InputOutputStream/DataInputStream.h"
|
||||
#include "java/InputOutputStream/DataOutputStream.h"
|
||||
|
||||
AwardStatPacket::AwardStatPacket() {
|
||||
this->m_paramData.clear();
|
||||
}
|
||||
AwardStatPacket::AwardStatPacket() { this->m_paramData.clear(); }
|
||||
|
||||
AwardStatPacket::AwardStatPacket(int statId, int count) {
|
||||
this->statId = statId;
|
||||
@@ -26,9 +24,7 @@ AwardStatPacket::AwardStatPacket(int statId, std::vector<uint8_t>& paramData) {
|
||||
this->m_paramData = paramData;
|
||||
}
|
||||
|
||||
AwardStatPacket::~AwardStatPacket() {
|
||||
m_paramData.clear();
|
||||
}
|
||||
AwardStatPacket::~AwardStatPacket() { m_paramData.clear(); }
|
||||
|
||||
void AwardStatPacket::handle(PacketListener* listener) {
|
||||
listener->handleAwardStat(shared_from_this());
|
||||
|
||||
@@ -71,7 +71,8 @@ BlockRegionUpdatePacket::BlockRegionUpdatePacket(int x, int y, int z, int xs,
|
||||
unsigned int inputSize = (256 * 16 * 16 * 5) / 2;
|
||||
|
||||
Compression::getCompression()->CompressLZXRLE(
|
||||
ucTemp, &inputSize, rawBuffer.data(), (unsigned int)rawBuffer.size());
|
||||
ucTemp, &inputSize, rawBuffer.data(),
|
||||
(unsigned int)rawBuffer.size());
|
||||
// app.DebugPrintf("Chunk (%d,%d) compressed from %d to size %d\n",
|
||||
// x>>4, z>>4, rawBuffer.size(), inputSize);
|
||||
unsigned char* ucTemp2 = new unsigned char[inputSize];
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
#include "minecraft/world/level/Level.h"
|
||||
#include "minecraft/world/level/chunk/LevelChunk.h"
|
||||
|
||||
ChunkTilesUpdatePacket::~ChunkTilesUpdatePacket() {
|
||||
}
|
||||
ChunkTilesUpdatePacket::~ChunkTilesUpdatePacket() {}
|
||||
|
||||
ChunkTilesUpdatePacket::ChunkTilesUpdatePacket() {
|
||||
shouldDelay = true;
|
||||
|
||||
@@ -23,8 +23,8 @@ public:
|
||||
|
||||
ChunkTilesUpdatePacket();
|
||||
~ChunkTilesUpdatePacket();
|
||||
ChunkTilesUpdatePacket(int xc, int zc, std::vector<short>& positions, uint8_t count,
|
||||
Level* level);
|
||||
ChunkTilesUpdatePacket(int xc, int zc, std::vector<short>& positions,
|
||||
uint8_t count, Level* level);
|
||||
|
||||
virtual void read(DataInputStream* dis);
|
||||
virtual void write(DataOutputStream* dos);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
class ClientInformationPacket : public Packet {};
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "java/InputOutputStream/DataInputStream.h"
|
||||
#include "java/InputOutputStream/DataOutputStream.h"
|
||||
|
||||
|
||||
ComplexItemDataPacket::~ComplexItemDataPacket() {}
|
||||
|
||||
ComplexItemDataPacket::ComplexItemDataPacket() {
|
||||
@@ -40,7 +39,8 @@ void ComplexItemDataPacket::write(DataOutputStream* dos) // throws IOException
|
||||
dos->writeShort(itemId);
|
||||
dos->writeUnsignedShort(data.size());
|
||||
|
||||
std::vector<uint8_t> ba((uint8_t*)data.data(), (uint8_t*)data.data() + data.size());
|
||||
std::vector<uint8_t> ba((uint8_t*)data.data(),
|
||||
(uint8_t*)data.data() + data.size());
|
||||
dos->write(ba);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@ public:
|
||||
|
||||
ComplexItemDataPacket();
|
||||
~ComplexItemDataPacket();
|
||||
ComplexItemDataPacket(short itemType, short itemId, std::vector<char>& data);
|
||||
ComplexItemDataPacket(short itemType, short itemId,
|
||||
std::vector<char>& data);
|
||||
|
||||
virtual void read(DataInputStream* dis);
|
||||
virtual void write(DataOutputStream* dos);
|
||||
|
||||
@@ -11,7 +11,7 @@ ContainerSetContentPacket::~ContainerSetContentPacket() {}
|
||||
ContainerSetContentPacket::ContainerSetContentPacket() { containerId = 0; }
|
||||
|
||||
ContainerSetContentPacket::ContainerSetContentPacket(
|
||||
int containerId, std::vector<std::shared_ptr<ItemInstance> >* newItems) {
|
||||
int containerId, std::vector<std::shared_ptr<ItemInstance>>* newItems) {
|
||||
this->containerId = containerId;
|
||||
items = std::vector<std::shared_ptr<ItemInstance>>((int)newItems->size());
|
||||
for (unsigned int i = 0; i < items.size(); i++) {
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
ContainerSetContentPacket();
|
||||
~ContainerSetContentPacket();
|
||||
ContainerSetContentPacket(
|
||||
int containerId, std::vector<std::shared_ptr<ItemInstance> >* newItems);
|
||||
int containerId, std::vector<std::shared_ptr<ItemInstance>>* newItems);
|
||||
|
||||
virtual void read(DataInputStream* dis);
|
||||
virtual void write(DataOutputStream* dos);
|
||||
|
||||
@@ -28,7 +28,8 @@ public:
|
||||
std::vector<uint8_t> data;
|
||||
|
||||
CustomPayloadPacket();
|
||||
CustomPayloadPacket(const std::wstring& identifier, std::vector<uint8_t> data);
|
||||
CustomPayloadPacket(const std::wstring& identifier,
|
||||
std::vector<uint8_t> data);
|
||||
|
||||
virtual void read(DataInputStream* dis);
|
||||
virtual void write(DataOutputStream* dos);
|
||||
|
||||
@@ -12,7 +12,8 @@ GameCommandPacket::GameCommandPacket() { length = 0; }
|
||||
|
||||
GameCommandPacket::~GameCommandPacket() {}
|
||||
|
||||
GameCommandPacket::GameCommandPacket(EGameCommand command, std::vector<uint8_t> data) {
|
||||
GameCommandPacket::GameCommandPacket(EGameCommand command,
|
||||
std::vector<uint8_t> data) {
|
||||
this->command = command;
|
||||
this->data = data;
|
||||
length = 0;
|
||||
@@ -31,7 +32,6 @@ GameCommandPacket::GameCommandPacket(EGameCommand command, std::vector<uint8_t>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GameCommandPacket::read(DataInputStream* dis) {
|
||||
command = (EGameCommand)dis->readInt();
|
||||
length = dis->readShort();
|
||||
|
||||
@@ -456,7 +456,8 @@ std::shared_ptr<Packet> Packet::getPacket(int id) {
|
||||
return idToCreateMap[id]();
|
||||
}
|
||||
|
||||
void Packet::writeBytes(DataOutputStream* dataoutputstream, const std::vector<uint8_t>& bytes) {
|
||||
void Packet::writeBytes(DataOutputStream* dataoutputstream,
|
||||
const std::vector<uint8_t>& bytes) {
|
||||
dataoutputstream->writeShort(bytes.size());
|
||||
dataoutputstream->write(bytes);
|
||||
}
|
||||
@@ -670,8 +671,7 @@ std::shared_ptr<ItemInstance> Packet::readItem(DataInputStream* dis) {
|
||||
int count = dis->readByte();
|
||||
int damage = dis->readShort();
|
||||
|
||||
item =
|
||||
std::make_shared<ItemInstance>(id, count, damage);
|
||||
item = std::make_shared<ItemInstance>(id, count, damage);
|
||||
// 4J Stu - Always read/write the tag
|
||||
// if (Item.items[id].canBeDepleted() ||
|
||||
// Item.items[id].shouldOverrideMultiplayerNBT())
|
||||
|
||||
@@ -74,7 +74,8 @@ public:
|
||||
// 4J Added
|
||||
static bool canSendToAnyClient(std::shared_ptr<Packet> packet);
|
||||
|
||||
static void writeBytes(DataOutputStream* dataoutputstream, const std::vector<uint8_t>& bytes);
|
||||
static void writeBytes(DataOutputStream* dataoutputstream,
|
||||
const std::vector<uint8_t>& bytes);
|
||||
static std::vector<uint8_t> readBytes(DataInputStream* datainputstream);
|
||||
|
||||
virtual int getId() = 0;
|
||||
|
||||
@@ -16,7 +16,7 @@ PreLoginPacket::PreLoginPacket() {
|
||||
m_dwPlayerCount = 0;
|
||||
m_friendsOnlyBits = 0;
|
||||
m_ugcPlayersVersion = 0;
|
||||
memset(m_szUniqueSaveName, 0, m_iSaveNameLen);
|
||||
memset(m_szUniqueSaveName, 0, m_iSaveNameLen);
|
||||
m_serverSettings = 0;
|
||||
m_hostIndex = 0;
|
||||
m_texturePackId = 0;
|
||||
@@ -29,7 +29,7 @@ PreLoginPacket::PreLoginPacket(std::wstring userName) {
|
||||
m_dwPlayerCount = 0;
|
||||
m_friendsOnlyBits = 0;
|
||||
m_ugcPlayersVersion = 0;
|
||||
memset(m_szUniqueSaveName, 0, m_iSaveNameLen);
|
||||
memset(m_szUniqueSaveName, 0, m_iSaveNameLen);
|
||||
m_serverSettings = 0;
|
||||
m_hostIndex = 0;
|
||||
m_texturePackId = 0;
|
||||
|
||||
@@ -5,11 +5,12 @@
|
||||
|
||||
RemoveEntitiesPacket::RemoveEntitiesPacket() {}
|
||||
|
||||
RemoveEntitiesPacket::RemoveEntitiesPacket(std::vector<int>& ids) { this->ids = ids; }
|
||||
|
||||
RemoveEntitiesPacket::~RemoveEntitiesPacket() {
|
||||
RemoveEntitiesPacket::RemoveEntitiesPacket(std::vector<int>& ids) {
|
||||
this->ids = ids;
|
||||
}
|
||||
|
||||
RemoveEntitiesPacket::~RemoveEntitiesPacket() {}
|
||||
|
||||
void RemoveEntitiesPacket::read(DataInputStream* dis) // throws IOException
|
||||
{
|
||||
ids = std::vector<int>(dis->readByte());
|
||||
|
||||
@@ -8,7 +8,7 @@ SetHealthPacket::SetHealthPacket() {
|
||||
this->food = 0;
|
||||
this->saturation = 0;
|
||||
|
||||
this->damageSource = 0; // 4jcraft: previously eTelemetryChallenges_Unknown
|
||||
this->damageSource = 0; // 4jcraft: previously eTelemetryChallenges_Unknown
|
||||
}
|
||||
|
||||
SetHealthPacket::SetHealthPacket(float health, int food, float saturation,
|
||||
|
||||
Reference in New Issue
Block a user