mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-05-26 00:17:15 +00:00
chore: format Minecraft.World
This commit is contained in:
@@ -7,59 +7,48 @@
|
||||
#include "PacketListener.h"
|
||||
#include "AddGlobalEntityPacket.h"
|
||||
|
||||
|
||||
|
||||
const int AddGlobalEntityPacket::LIGHTNING = 1;
|
||||
|
||||
AddGlobalEntityPacket::AddGlobalEntityPacket()
|
||||
{
|
||||
id = -1;
|
||||
x = 0;
|
||||
y = 0;
|
||||
x = 0;
|
||||
type = 0;
|
||||
AddGlobalEntityPacket::AddGlobalEntityPacket() {
|
||||
id = -1;
|
||||
x = 0;
|
||||
y = 0;
|
||||
x = 0;
|
||||
type = 0;
|
||||
}
|
||||
|
||||
AddGlobalEntityPacket::AddGlobalEntityPacket(std::shared_ptr<Entity> e)
|
||||
{
|
||||
id = e->entityId;
|
||||
AddGlobalEntityPacket::AddGlobalEntityPacket(std::shared_ptr<Entity> e) {
|
||||
id = e->entityId;
|
||||
x = Mth::floor(e->x * 32);
|
||||
y = Mth::floor(e->y * 32);
|
||||
z = Mth::floor(e->z * 32);
|
||||
if (std::dynamic_pointer_cast<LightningBolt>(e) != NULL)
|
||||
{
|
||||
this->type = LIGHTNING;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->type = 0;
|
||||
}
|
||||
if (std::dynamic_pointer_cast<LightningBolt>(e) != NULL) {
|
||||
this->type = LIGHTNING;
|
||||
} else {
|
||||
this->type = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void AddGlobalEntityPacket::read(DataInputStream *dis) // throws IOException
|
||||
void AddGlobalEntityPacket::read(DataInputStream* dis) // throws IOException
|
||||
{
|
||||
id = dis->readInt();
|
||||
type = static_cast<int>(dis->readByte());
|
||||
x = dis->readInt();
|
||||
y = dis->readInt();
|
||||
z = dis->readInt();
|
||||
id = dis->readInt();
|
||||
type = static_cast<int>(dis->readByte());
|
||||
x = dis->readInt();
|
||||
y = dis->readInt();
|
||||
z = dis->readInt();
|
||||
}
|
||||
|
||||
void AddGlobalEntityPacket::write(DataOutputStream *dos) // throws IOException
|
||||
void AddGlobalEntityPacket::write(DataOutputStream* dos) // throws IOException
|
||||
{
|
||||
dos->writeInt(id);
|
||||
dos->writeByte(static_cast<uint8_t>(type));
|
||||
dos->writeInt(x);
|
||||
dos->writeInt(y);
|
||||
dos->writeInt(z);
|
||||
dos->writeInt(id);
|
||||
dos->writeByte(static_cast<uint8_t>(type));
|
||||
dos->writeInt(x);
|
||||
dos->writeInt(y);
|
||||
dos->writeInt(z);
|
||||
}
|
||||
|
||||
void AddGlobalEntityPacket::handle(PacketListener *listener)
|
||||
{
|
||||
listener->handleAddGlobalEntity(shared_from_this());
|
||||
void AddGlobalEntityPacket::handle(PacketListener* listener) {
|
||||
listener->handleAddGlobalEntity(shared_from_this());
|
||||
}
|
||||
|
||||
int AddGlobalEntityPacket::getEstimatedSize()
|
||||
{
|
||||
return 17;
|
||||
}
|
||||
int AddGlobalEntityPacket::getEstimatedSize() { return 17; }
|
||||
|
||||
Reference in New Issue
Block a user