mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-05-25 04:25:10 +00:00
chore: format Minecraft.World
This commit is contained in:
@@ -4,63 +4,52 @@
|
||||
#include "PacketListener.h"
|
||||
#include "TexturePacket.h"
|
||||
|
||||
|
||||
|
||||
TexturePacket::TexturePacket()
|
||||
{
|
||||
this->textureName = L"";
|
||||
this->dataBytes = 0;
|
||||
this->pbData = NULL;
|
||||
TexturePacket::TexturePacket() {
|
||||
this->textureName = L"";
|
||||
this->dataBytes = 0;
|
||||
this->pbData = NULL;
|
||||
}
|
||||
|
||||
TexturePacket::~TexturePacket()
|
||||
{
|
||||
// can't free this - it's used elsewhere
|
||||
// if(this->pbData!=NULL)
|
||||
// {
|
||||
// delete [] this->pbData;
|
||||
// }
|
||||
TexturePacket::~TexturePacket() {
|
||||
// can't free this - it's used elsewhere
|
||||
// if(this->pbData!=NULL)
|
||||
// {
|
||||
// delete [] this->pbData;
|
||||
// }
|
||||
}
|
||||
|
||||
TexturePacket::TexturePacket(const std::wstring &textureName, std::uint8_t *pbData, std::uint32_t dataBytes)
|
||||
{
|
||||
this->textureName = textureName;
|
||||
this->pbData = pbData;
|
||||
this->dataBytes = dataBytes;
|
||||
TexturePacket::TexturePacket(const std::wstring& textureName,
|
||||
std::uint8_t* pbData, std::uint32_t dataBytes) {
|
||||
this->textureName = textureName;
|
||||
this->pbData = pbData;
|
||||
this->dataBytes = dataBytes;
|
||||
}
|
||||
|
||||
void TexturePacket::handle(PacketListener *listener)
|
||||
{
|
||||
listener->handleTexture(shared_from_this());
|
||||
void TexturePacket::handle(PacketListener* listener) {
|
||||
listener->handleTexture(shared_from_this());
|
||||
}
|
||||
|
||||
void TexturePacket::read(DataInputStream *dis) //throws IOException
|
||||
void TexturePacket::read(DataInputStream* dis) // throws IOException
|
||||
{
|
||||
textureName = dis->readUTF();
|
||||
dataBytes = (std::uint32_t)dis->readShort();
|
||||
textureName = dis->readUTF();
|
||||
dataBytes = (std::uint32_t)dis->readShort();
|
||||
|
||||
if(dataBytes>0)
|
||||
{
|
||||
this->pbData= new std::uint8_t [dataBytes];
|
||||
if (dataBytes > 0) {
|
||||
this->pbData = new std::uint8_t[dataBytes];
|
||||
|
||||
for(std::uint32_t i=0;i<dataBytes;i++)
|
||||
{
|
||||
this->pbData[i] = dis->readByte();
|
||||
}
|
||||
}
|
||||
for (std::uint32_t i = 0; i < dataBytes; i++) {
|
||||
this->pbData[i] = dis->readByte();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TexturePacket::write(DataOutputStream *dos) //throws IOException
|
||||
void TexturePacket::write(DataOutputStream* dos) // throws IOException
|
||||
{
|
||||
dos->writeUTF(textureName);
|
||||
dos->writeShort((short)dataBytes);
|
||||
for(std::uint32_t i=0;i<dataBytes;i++)
|
||||
{
|
||||
dos->writeByte(this->pbData[i]);
|
||||
}
|
||||
dos->writeUTF(textureName);
|
||||
dos->writeShort((short)dataBytes);
|
||||
for (std::uint32_t i = 0; i < dataBytes; i++) {
|
||||
dos->writeByte(this->pbData[i]);
|
||||
}
|
||||
}
|
||||
|
||||
int TexturePacket::getEstimatedSize()
|
||||
{
|
||||
return 4096;
|
||||
}
|
||||
int TexturePacket::getEstimatedSize() { return 4096; }
|
||||
|
||||
Reference in New Issue
Block a user