Skip to content

Commit baee684

Browse files
committed
feat: adapt to LeviLamina 0.12.x
1 parent 44b413f commit baee684

File tree

5 files changed

+10
-12
lines changed

5 files changed

+10
-12
lines changed

src/legacy/api/CommandAPI.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ Local<Value> McClass::runcmd(const Arguments& args) {
183183
CATCH("Fail in RunCmd!")
184184
}
185185

186-
I18n* getI18n(); // Stupid Mojang
186+
I18n& getI18n(); // Stupid Mojang
187187

188188
Local<Value> McClass::runcmdEx(const Arguments& args) {
189189
CHECK_ARGS_COUNT(args, 1)
@@ -204,7 +204,7 @@ Local<Value> McClass::runcmdEx(const Arguments& args) {
204204
command->run(origin, output);
205205
for (auto msg : output.getMessages()) {
206206
std::string temp;
207-
getI18n()->getCurrentLanguage()->get(msg.getMessageId(), temp, msg.getParams());
207+
getI18n().getCurrentLanguage()->get(msg.getMessageId(), temp, msg.getParams());
208208
outputStr += temp.append("\n");
209209
}
210210
if (output.getMessages().size()) {

src/legacy/events/EventHooks.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,18 @@ LL_TYPE_INSTANCE_HOOK(
6969
void,
7070
Player& player,
7171
BlockPos const& blockPos,
72+
Block const& block,
7273
uchar unk_char
7374
) {
7475
IF_LISTENED(EVENT_TYPES::onStartDestroyBlock) {
7576
CallEventVoid(
7677
EVENT_TYPES::onStartDestroyBlock,
7778
PlayerClass::newPlayer(&player),
78-
BlockClass::newBlock(blockPos, player.getDimensionId())
79+
BlockClass::newBlock(&block, &blockPos, player.getDimensionId())
7980
);
8081
}
8182
IF_LISTENED_END(EVENT_TYPES::onStartDestroyBlock)
82-
origin(player, blockPos, unk_char);
83+
origin(player, blockPos, block, unk_char);
8384
}
8485

8586
LL_TYPE_INSTANCE_HOOK(

src/legacy/legacyapi/command/DynamicCommand.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ DynamicCommandInstance::DynamicCommandInstance(
688688
description_(std::make_unique<std::string>(description)),
689689
permission_(permission),
690690
flag_(flag),
691-
builder(std::make_unique<ll::memory::NativeClosure<std::unique_ptr<Command>>>(commandBuilder, (uintptr_t)this)) {}
691+
builder(std::make_unique<ll::memory::NativeClosure<std::unique_ptr<Command>()>>(commandBuilder, (uintptr_t)this)) {}
692692

693693
DynamicCommandInstance::~DynamicCommandInstance() = default;
694694

src/legacy/legacyapi/command/DynamicCommand.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "fmt/core.h"
44
#include "ll/api/base/Concepts.h"
55
#include "ll/api/base/Macro.h"
6+
#include "ll/api/memory/Closure.h"
67
#include "ll/api/memory/Memory.h"
78
#include "ll/api/service/Bedrock.h"
89
#include "magic_enum.hpp"
@@ -43,11 +44,6 @@
4344
#include <utility>
4445
#include <vector>
4546

46-
namespace ll::memory {
47-
template <class Ret, class... Args>
48-
class NativeClosure;
49-
}
50-
5147
class Actor;
5248
class DynamicCommandInstance;
5349

@@ -600,7 +596,7 @@ class DynamicCommandInstance {
600596
CommandFlag flag_;
601597

602598
public:
603-
std::unique_ptr<ll::memory::NativeClosure<std::unique_ptr<Command>>> builder;
599+
std::unique_ptr<ll::memory::NativeClosure<std::unique_ptr<Command>()>> builder;
604600
// Parameter Pointers to DynamicCommand Extra Part
605601
size_t commandSize = sizeof(DynamicCommand);
606602
std::unordered_map<std::string, DynamicCommand::ParameterPtr> parameterPtrs = {};

src/lse/PluginMigration.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include "Entry.h"
44
#include "legacyapi/utils/FileHelper.h"
5+
#include "ll/api/Expected.h"
56

67
#include <filesystem>
78
#include <fmt/format.h>
@@ -99,7 +100,7 @@ auto migratePlugin(const PluginManager& pluginManager, const std::filesystem::pa
99100
std::filesystem::remove(path);
100101
#endif
101102

102-
auto manifestJson = ll::reflection::serialize<nlohmann::ordered_json>(manifest);
103+
auto manifestJson = ll::reflection::serialize<nlohmann::ordered_json>(manifest).value();
103104

104105
std::ofstream manifestFile{pluginDir / "manifest.json"};
105106
manifestFile << manifestJson.dump(4);

0 commit comments

Comments
 (0)