Skip to content

Commit 5654215

Browse files
committed
fix: replace ServerInstanceEventCoordinator::sendServerInitializeEnd with ServerScriptManager::$onServerThreadStarted to fix #1636
1 parent 904c6f4 commit 5654215

File tree

13 files changed

+75
-58
lines changed

13 files changed

+75
-58
lines changed

CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.1.1] - 2025-03-15
11+
12+
### Fixed
13+
14+
- Added default constructor for SubChunkPacketData @ShrBox
15+
- Added missing operator== for InventorySource @ShrBox
16+
- Fixed mod not loaded when it dependencies is an empty array (#1633) @killcerr
17+
- Fixed mce::UUID::fromStringHash and SimulatedPlayer::tryGetFromEntity (#1634) @xiaoqch
18+
- Fixed CustomFormResult for dropdown element(#1637) @xiaoqch
19+
- Fixed wrong type of IDType @ShrBox
20+
- Replaced ServerInstanceEventCoordinator::sendServerInitializeEnd with ServerScriptManager::$onServerThreadStarted to fix [#1636] @ShrBox
21+
1022
## [1.1.0] - 2025-02-28
1123

1224
### Added
@@ -838,8 +850,10 @@ For lip and tooth-hub test only.
838850
[#1611]: https://github.com/LiteLDev/LeviLamina/issues/1611
839851
[#1622]: https://github.com/LiteLDev/LeviLamina/issues/1622
840852
[#1631]: https://github.com/LiteLDev/LeviLamina/issues/1631
853+
[#1636]: https://github.com/LiteLDev/LeviLamina/issues/1636
841854

842-
[Unreleased]: https://github.com/LiteLDev/LeviLamina/compare/v1.1.0...HEAD
855+
[Unreleased]: https://github.com/LiteLDev/LeviLamina/compare/v1.1.1...HEAD
856+
[1.1.1]: https://github.com/LiteLDev/LeviLamina/compare/v1.1.0...v1.1.1
843857
[1.1.0]: https://github.com/LiteLDev/LeviLamina/compare/v1.1.0-rc.1...v1.1.0
844858
[1.1.0-rc.1]: https://github.com/LiteLDev/LeviLamina/compare/v1.0.1...v1.1.0-rc.1
845859
[1.0.1]: https://github.com/LiteLDev/LeviLamina/compare/v1.0.0...v1.0.1

docs/main/contents/developer_guides/how_to_guides/event_guide.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,8 @@ LL_TYPE_INSTANCE_HOOK(
118118
#include "ll/api/event/EventRefObjSerializer.h"
119119
#include "ll/api/memory/Hook.h"
120120

121-
#include "mc/gameplayhandlers/ServerInstanceEventHandler.h"
122121
#include "mc/nbt/CompoundTag.h"
123-
#include "mc/world/events/ServerInstanceEventCoordinator.h"
122+
#include "mc/scripting/ServerScriptManager.h"
124123

125124
namespace ll::event::inline server {
126125

@@ -134,13 +133,14 @@ ServerInstance& ServerStartedEvent::server() const { return mInstance; }
134133
LL_TYPE_INSTANCE_HOOK(
135134
ServerStartedEventHook,
136135
ll::memory::HookPriority::Normal,
137-
ServerInstanceEventCoordinator,
138-
&ServerInstanceEventCoordinator::sendServerInitializeEnd,
139-
void,
136+
ServerScriptManager,
137+
&ServerScriptManager::$onServerThreadStarted,
138+
EventResult,
140139
::ServerInstance& ins
141140
) {
142-
origin(ins);
141+
auto result = origin(ins);
143142
EventBus::getInstance().publish(ServerStartedEvent(ins));
143+
return result;
144144
}
145145

146146
static std::unique_ptr<EmitterBase> emitterFactory();

docs/main/contents/developer_guides/how_to_guides/event_guide.zh.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,8 @@ LL_TYPE_INSTANCE_HOOK(
112112
#include "ll/api/event/EventRefObjSerializer.h"
113113
#include "ll/api/memory/Hook.h"
114114

115-
#include "mc/gameplayhandlers/ServerInstanceEventHandler.h"
116115
#include "mc/nbt/CompoundTag.h"
117-
#include "mc/world/events/ServerInstanceEventCoordinator.h"
116+
#include "mc/scripting/ServerScriptManager.h"
118117

119118
namespace ll::event::inline server {
120119

@@ -128,13 +127,14 @@ ServerInstance& ServerStartedEvent::server() const { return mInstance; }
128127
LL_TYPE_INSTANCE_HOOK(
129128
ServerStartedEventHook,
130129
ll::memory::HookPriority::Normal,
131-
ServerInstanceEventCoordinator,
132-
&ServerInstanceEventCoordinator::sendServerInitializeEnd,
133-
void,
130+
ServerScriptManager,
131+
&ServerScriptManager::$onServerThreadStarted,
132+
EventResult,
134133
::ServerInstance& ins
135134
) {
136-
origin(ins);
135+
auto result = origin(ins);
137136
EventBus::getInstance().publish(ServerStartedEvent(ins));
137+
return result;
138138
}
139139

140140
static std::unique_ptr<EmitterBase> emitterFactory();

src-client/ll/core/main_win.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#include "ll/core/gui/ImGuiHooks.h"
1515
#include "ll/core/mod/ModRegistrar.h"
1616

17+
#include "mc/scripting/ServerScriptManager.h"
1718
#include "mc/server/ServerInstance.h"
18-
#include "mc/world/events/ServerInstanceEventCoordinator.h"
1919
#include "mc/world/level/Level.h"
2020

2121
#include "mc/deps/core/string/StringHash.h"
@@ -60,20 +60,22 @@ LL_AUTO_TYPE_INSTANCE_HOOK(
6060
EnableAllModsHook,
6161
HookPriority::High,
6262
ServerInstanceEventCoordinator,
63-
&ServerInstanceEventCoordinator::sendServerInitializeEnd,
64-
void,
63+
ServerScriptManager,
64+
&ServerScriptManager::$onServerThreadStarted,
65+
EventResult,
6566
::ServerInstance& ins
6667
) {
6768
getLogger().debug("sendServerInitializeEnd");
6869

69-
origin(ins);
70+
auto result = origin(ins);
7071
service::bedrock::serverInstance = std::addressof(ins);
7172

7273
CrashLogger::init();
7374

7475
mod::ModRegistrar::getInstance().enableAllMods();
7576

7677
setGamingStatus(GamingStatus::Running);
78+
return result;
7779
}
7880
LL_AUTO_TYPE_INSTANCE_HOOK(
7981
DisableAllModsHook,

src-server/ll/api/event/server/ServerStartedEvent.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
#include "ll/api/event/EventRefObjSerializer.h"
44
#include "ll/api/memory/Hook.h"
55

6-
#include "mc/gameplayhandlers/ServerInstanceEventHandler.h"
76
#include "mc/nbt/CompoundTag.h"
8-
#include "mc/world/events/ServerInstanceEventCoordinator.h"
7+
#include "mc/scripting/ServerScriptManager.h"
98

109
namespace ll::event::inline server {
1110

@@ -19,13 +18,14 @@ ServerInstance& ServerStartedEvent::server() const { return mInstance; }
1918
LL_TYPE_INSTANCE_HOOK(
2019
ServerStartedEventHook,
2120
ll::memory::HookPriority::Normal,
22-
ServerInstanceEventCoordinator,
23-
&ServerInstanceEventCoordinator::sendServerInitializeEnd,
24-
void,
21+
ServerScriptManager,
22+
&ServerScriptManager::$onServerThreadStarted,
23+
EventResult,
2524
::ServerInstance& ins
2625
) {
27-
origin(ins);
26+
auto result = origin(ins);
2827
EventBus::getInstance().publish(ServerStartedEvent(ins));
28+
return result;
2929
}
3030

3131
static std::unique_ptr<EmitterBase> emitterFactory();

src-server/ll/core/main_win.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@
2323
#include "ll/api/utils/HashUtils.h"
2424
#include "ll/api/utils/SystemUtils.h"
2525

26-
#include "mc/gameplayhandlers/ServerInstanceEventHandler.h"
2726
#include "mc/server/DedicatedServer.h"
2827
#include "mc/server/ServerInstance.h"
2928
#include "mc/server/commands/StopCommand.h"
30-
#include "mc/world/events/ServerInstanceEventCoordinator.h"
29+
#include "mc/scripting/ServerScriptManager.h"
3130

3231
#include "ll/core/Config.h"
3332
#include "ll/core/CrashLogger.h"
@@ -229,18 +228,19 @@ LL_AUTO_STATIC_HOOK(LeviLaminaMainHook, HookPriority::High, "main"_sym, int, int
229228
LL_AUTO_TYPE_INSTANCE_HOOK(
230229
EnableAllModsHook,
231230
HookPriority::High,
232-
ServerInstanceEventCoordinator,
233-
&ServerInstanceEventCoordinator::sendServerInitializeEnd,
234-
void,
231+
ServerScriptManager,
232+
&ServerScriptManager::$onServerThreadStarted,
233+
EventResult,
235234
::ServerInstance& ins
236235
) {
237-
origin(ins);
236+
auto result = origin(ins);
238237

239238
CrashLogger::init();
240239

241240
mod::ModRegistrar::getInstance().enableAllMods();
242241

243242
setGamingStatus(GamingStatus::Running);
243+
return result;
244244
}
245245
LL_AUTO_TYPE_INSTANCE_HOOK(
246246
DisableAllModsHook,

src-test/server/EventTest.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
#include "ll/api/utils/StringUtils.h"
99
#include "ll/core/LeviLamina.h"
1010
#include "mc/network/packet/TextPacket.h"
11+
#include "mc/scripting/ServerScriptManager.h"
1112
#include "mc/server/ServerInstance.h"
12-
#include "mc/world/events/ServerInstanceEventCoordinator.h"
1313

1414
#include "ll/api/event/DynamicListener.h"
1515
#include "ll/api/event/Emitter.h"
@@ -62,12 +62,12 @@ class TestEventEmitter
6262
LL_AUTO_TYPE_INSTANCE_HOOK(
6363
EventTestH,
6464
ll::memory::HookPriority::Normal,
65-
ServerInstanceEventCoordinator,
66-
&ServerInstanceEventCoordinator::sendServerInitializeEnd,
67-
void,
65+
ServerScriptManager,
66+
&ServerScriptManager::$onServerThreadStarted,
67+
EventResult,
6868
::ServerInstance& ins
6969
) {
70-
origin(ins);
70+
auto result = origin(ins);
7171

7272
auto& bus = ll::event::EventBus::getInstance();
7373

@@ -146,4 +146,5 @@ LL_AUTO_TYPE_INSTANCE_HOOK(
146146
}
147147
};
148148
ll::getLogger().addSink(std::make_shared<BroadcastSink>());
149+
return result;
149150
}

src-test/server/FormTest.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include "mc/server/commands/CommandOutput.h"
1616
#include "mc/server/commands/CommandPermissionLevel.h"
1717
#include "mc/world/actor/player/Player.h"
18-
#include "mc/world/events/ServerInstanceEventCoordinator.h"
18+
#include "mc/scripting/ServerScriptManager.h"
1919

2020

2121
namespace ll::test::formtest {
@@ -100,13 +100,14 @@ void registerFormTestCommand() {
100100
LL_TYPE_INSTANCE_HOOK(
101101
registerBuiltinCommands,
102102
ll::memory::HookPriority::Normal,
103-
ServerInstanceEventCoordinator,
104-
&ServerInstanceEventCoordinator::sendServerInitializeEnd,
105-
void,
103+
ServerScriptManager,
104+
&ServerScriptManager::$onServerThreadStarted,
105+
EventResult,
106106
::ServerInstance& ins
107107
) {
108-
origin(ins);
108+
auto result = origin(ins);
109109
registerFormTestCommand();
110+
return result;
110111
}
111112

112113
ll::memory::HookRegistrar<registerBuiltinCommands> hooks{};

src-test/server/RecipesTest.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
#include "magic_enum/magic_enum.hpp"
66
#include "mc/deps/json/Value.h"
77
#include "mc/nbt/CompoundTag.h"
8+
#include "mc/scripting/ServerScriptManager.h"
89
#include "mc/server/ServerInstance.h"
910
#include "mc/server/ServerLevel.h"
10-
#include "mc/world/events/ServerInstanceEventCoordinator.h"
1111
#include "mc/world/item/Item.h"
1212
#include "mc/world/item/ItemInstance.h"
1313
#include "nlohmann/json.hpp"
@@ -19,12 +19,12 @@
1919
LL_AUTO_TYPE_INSTANCE_HOOK(
2020
TestRecipesHook,
2121
HookPriority::Normal,
22-
ServerInstanceEventCoordinator,
23-
&ServerInstanceEventCoordinator::sendServerInitializeEnd,
24-
void,
22+
ServerScriptManager,
23+
&ServerScriptManager::$onServerThreadStarted,
24+
EventResult,
2525
::ServerInstance& ins
2626
) {
27-
origin(ins);
27+
auto result = origin(ins);
2828

2929
using namespace ll::string_utils;
3030

@@ -149,6 +149,7 @@ LL_AUTO_TYPE_INSTANCE_HOOK(
149149
file << multitable.dump(4) << std::flush;
150150
file.close();
151151
}
152+
return result;
152153
}
153154

154155
#endif // TestRecipes

src-test/server/TestMolang.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,20 @@
66

77
#include "ll/api/memory/Hook.h"
88
#include "mc/server/commands/CommandOutput.h"
9-
#include "mc/world/events/ServerInstanceEventCoordinator.h"
9+
#include "mc/scripting/ServerScriptManager.h"
1010

1111
#include "ll/api/io/Logger.h"
1212
#include "ll/api/io/LoggerRegistry.h"
1313
#include "mc/deps/core/string/HashedString.h"
14-
#include "mc/deps/core/utility/AutomaticID.h"
15-
#include "mc/server/commands/CommandBlockName.h"
1614

1715

1816
namespace {
1917
LL_AUTO_TYPE_INSTANCE_HOOK(
2018
testtttt,
2119
ll::memory::HookPriority::Low,
22-
ServerInstanceEventCoordinator,
23-
&ServerInstanceEventCoordinator::sendServerInitializeEnd,
24-
void,
20+
ServerScriptManager,
21+
&ServerScriptManager::$onServerThreadStarted,
22+
EventResult,
2523
::ServerInstance& ins
2624
) {
2725
static auto ptr = ll::io::LoggerRegistry::getInstance().getOrCreate("MolangTest");
@@ -62,6 +60,6 @@ LL_AUTO_TYPE_INSTANCE_HOOK(
6260
"query.homo_number: {}",
6361
ExpressionNode("query.homo_number", MolangVersion::Latest, {{HashedString{"default"}}}).evalAsFloat(parm)
6462
);
65-
origin(ins);
63+
return origin(ins);
6664
}
6765
} // namespace

src-test/server/testCommand.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
#include "ll/api/service/Bedrock.h"
99

1010
#include "mc/deps/core/utility/AutomaticID.h"
11+
#include "mc/scripting/ServerScriptManager.h"
1112
#include "mc/server/commands/CommandBlockName.h"
12-
#include "mc/world/events/ServerInstanceEventCoordinator.h"
1313

1414
#include "ll/api/command/runtime/RuntimeOverload.h"
1515

@@ -81,12 +81,12 @@ struct ParamTest3 {
8181
LL_AUTO_TYPE_INSTANCE_HOOK(
8282
registerBuiltinCommands,
8383
ll::memory::HookPriority::Normal,
84-
ServerInstanceEventCoordinator,
85-
&ServerInstanceEventCoordinator::sendServerInitializeEnd,
86-
void,
84+
ServerScriptManager,
85+
&ServerScriptManager::$onServerThreadStarted,
86+
EventResult,
8787
::ServerInstance& ins
8888
) {
89-
origin(ins);
89+
auto result = origin(ins);
9090

9191
auto& cmd = CommandRegistrar::getInstance().getOrCreateCommand("t", "test tttttt");
9292
static auto lambda = [](CommandOrigin const&, CommandOutput& output, ParamTest const& param) {
@@ -172,4 +172,5 @@ LL_AUTO_TYPE_INSTANCE_HOOK(
172172
ll::getLogger().debug("{} : {}", k, v);
173173
}
174174
});
175+
return result;
175176
}

src/ll/core/command/BuiltinCommands.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include "ll/api/memory/Hook.h"
33

44
#include "mc/server/DedicatedServerCommands.h"
5-
#include "mc/world/events/ServerInstanceEventCoordinator.h"
65

76

87
namespace ll::command {

tooth.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"format_version": 3,
33
"format_uuid": "289f771f-2c9a-4d73-9f3f-8492495a924d",
44
"tooth": "github.com/LiteLDev/LeviLamina",
5-
"version": "1.1.0",
5+
"version": "1.1.1",
66
"info": {
77
"name": "LeviLamina",
88
"description": "A lightweight, modular and versatile mod loader for Minecraft Bedrock Edition.",

0 commit comments

Comments
 (0)