* try to resolve merge conflict
* feat: TU19 (Dec 2014) Features & Content (#32)
* December 2014 files
* Working release build
* Fix compilation issues
* Add sound to Windows64Media
* Add DLC content and force Tutorial DLC
* Revert "Add DLC content and force Tutorial DLC"
This reverts commit 97a4399472.
* Disable broken light packing
* Disable breakpoint during DLC texture map load
Allows DLC loading but the DLC textures are still broken
* Fix post build not working
* ...
* fix vs2022 build
* fix cmake build
---------
Co-authored-by: Loki <lokirautio@gmail.com>
63 lines
1.3 KiB
C++
63 lines
1.3 KiB
C++
#include "stdafx.h"
|
|
#include "net.minecraft.world.entity.player.h"
|
|
#include "net.minecraft.world.scores.h"
|
|
#include "PacketListener.h"
|
|
#include "SetScorePacket.h"
|
|
|
|
SetScorePacket::SetScorePacket()
|
|
{
|
|
owner = L"";
|
|
objectiveName = L"";
|
|
score = 0;
|
|
method = 0;
|
|
}
|
|
|
|
SetScorePacket::SetScorePacket(Score *score, int method)
|
|
{
|
|
owner = score->getOwner();
|
|
objectiveName = score->getObjective()->getName();
|
|
this->score = score->getScore();
|
|
this->method = method;
|
|
}
|
|
|
|
SetScorePacket::SetScorePacket(const wstring &owner)
|
|
{
|
|
this->owner = owner;
|
|
objectiveName = L"";
|
|
score = 0;
|
|
method = METHOD_REMOVE;
|
|
}
|
|
|
|
void SetScorePacket::read(DataInputStream *dis)
|
|
{
|
|
owner = readUtf(dis, Player::MAX_NAME_LENGTH);
|
|
method = dis->readByte();
|
|
|
|
if (method != METHOD_REMOVE)
|
|
{
|
|
objectiveName = readUtf(dis, Objective::MAX_NAME_LENGTH);
|
|
score = dis->readInt();
|
|
}
|
|
}
|
|
|
|
void SetScorePacket::write(DataOutputStream *dos)
|
|
{
|
|
writeUtf(owner, dos);
|
|
dos->writeByte(method);
|
|
|
|
if (method != METHOD_REMOVE)
|
|
{
|
|
writeUtf(objectiveName, dos);
|
|
dos->writeInt(score);
|
|
}
|
|
}
|
|
|
|
void SetScorePacket::handle(PacketListener *listener)
|
|
{
|
|
listener->handleSetScore(shared_from_this());
|
|
}
|
|
|
|
int SetScorePacket::getEstimatedSize()
|
|
{
|
|
return 2 + (owner.empty() ? 0 : owner.length()) + 2 + (objectiveName.empty() ? 0 : objectiveName.length()) + 4 + 1;
|
|
} |