Skip to content

Commit c8be7b4

Browse files
committed
fix: fix ScorePacketInfo
1 parent 74459d3 commit c8be7b4

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ PackConstructorInitializers: CurrentLine
4343
PointerAlignment: Left
4444
TabWidth: 4
4545
UseTab: Never
46-
SortIncludes: CaseSensitive
46+
SortIncludes: Never
4747
IncludeBlocks: Regroup

src/legacy/api/PlayerAPI.cpp

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#include "mc/network/packet/LevelChunkPacket.h"
4040
#include "mc/network/packet/ModalFormRequestPacket.h"
4141
#include "mc/network/packet/RemoveObjectivePacket.h"
42-
#include "mc/network/packet/ScorePacketInfo.h"
4342
#include "mc/network/packet/SetDisplayObjectivePacket.h"
4443
#include "mc/network/packet/SetScorePacket.h"
4544
#include "mc/network/packet/SetTitlePacket.h"
@@ -78,6 +77,7 @@
7877
#include "mc/world/scores/ScoreInfo.h"
7978
#include "mc/world/scores/Scoreboard.h"
8079
#include "mc/world/scores/ScoreboardId.h"
80+
#include "mc/network/packet/ScorePacketInfo.h"
8181

8282
#include <algorithm>
8383
#include <climits>
@@ -2194,20 +2194,18 @@ Local<Value> PlayerClass::setSidebar(const Arguments& args) {
21942194
SetDisplayObjectivePacket
21952195
disObjPkt("sidebar", "FakeScoreObj", args[0].asString().toString(), "dummy", (ObjectiveSortOrder)sortOrder);
21962196
disObjPkt.sendTo(*player);
2197-
// todo: fix it
2198-
2199-
// std::vector<ScorePacketInfo> info;
2200-
// for (auto& i : data) {
2201-
// ScorePacketInfo pktInfo;
2202-
// pktInfo.mScoreboardId->mRawID = i.second;
2203-
// pktInfo.mObjectiveName = "FakeScoreObj";
2204-
// pktInfo.mIdentityType = IdentityDefinition::Type::FakePlayer;
2205-
// pktInfo.mScoreValue = i.second;
2206-
// pktInfo.mFakePlayerName = i.first;
2207-
// info.emplace_back(pktInfo);
2208-
// }
2209-
// SetScorePacket setPkt = SetScorePacket::change(info);
2210-
// setPkt.sendTo(*player);
2197+
std::vector<ScorePacketInfo> info;
2198+
for (auto& i : data) {
2199+
ScorePacketInfo pktInfo;
2200+
pktInfo.mScoreboardId->mRawID = i.second;
2201+
pktInfo.mObjectiveName = "FakeScoreObj";
2202+
pktInfo.mIdentityType = IdentityDefinition::Type::FakePlayer;
2203+
pktInfo.mScoreValue = i.second;
2204+
pktInfo.mFakePlayerName = i.first;
2205+
info.emplace_back(pktInfo);
2206+
}
2207+
SetScorePacket setPkt = SetScorePacket::change(info);
2208+
setPkt.sendTo(*player);
22112209
return Boolean::newBoolean(true);
22122210
}
22132211
CATCH("Fail in setSidebar!")

0 commit comments

Comments
 (0)