From a4104535ccce89da082169cc25ae13e9f229b9f6 Mon Sep 17 00:00:00 2001 From: zimuya4153 Date: Thu, 23 Oct 2025 19:33:45 +0800 Subject: [PATCH] feat: adapt levilamina 1.5.x --- manifest.json | 3 +++ src/DebugStickItem.cpp | 14 +++++++------- tooth.json | 7 ++++--- xmake.lua | 10 ++++++---- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/manifest.json b/manifest.json index 30c9530..617daf7 100644 --- a/manifest.json +++ b/manifest.json @@ -8,6 +8,9 @@ "dependencies": [ { "name": "GMLIB" + }, + { + "name": "ModAPI" } ] } \ No newline at end of file diff --git a/src/DebugStickItem.cpp b/src/DebugStickItem.cpp index e40ad12..19adc19 100644 --- a/src/DebugStickItem.cpp +++ b/src/DebugStickItem.cpp @@ -1,7 +1,5 @@ #include #include -#include -#include #include #include #include @@ -26,11 +24,13 @@ #include #include #include +#include +#include #include namespace DebugStick { -class DebugStickItem : public gmlib::mod::ICustomItem { +class DebugStickItem : public modapi::ICustomItem { public: enum class BlockUpdateFlag : uchar { None = 0, @@ -48,7 +48,7 @@ public: uint8_t getItemMaxStackSize() const override { return 1; } - gmlib::mod::ItemIcon getIcon() const override { return "stick"; } + modapi::ItemIcon getIcon() const override { return modapi::ItemIcon{"stick"}; } std::string getDisplayName() const override { return "item.debug_stick.name"; } @@ -315,11 +315,11 @@ public: }(); auto* block = (mEditBlocks[&player] = {pos, &player.getDimensionBlockSource().getBlock(pos)}).second; - auto title = fmt::format("%{0}.name", block->mLegacyBlock->mDescriptionId.get()); + auto title = fmt::format("%{0}.name", block->mBlockType->mDescriptionId.get()); if (gmlib::I18nAPI::get(title) == title.substr(1)) { title = fmt::format( "%{0}.name", - block->mLegacyBlock->asItemInstance(*block, nullptr).mItem->getDescriptionId() + block->mBlockType->asItemInstance(*block, nullptr).mItem->getDescriptionId() ); } gmlib::ui::CustomForm form(title); @@ -353,6 +353,6 @@ public: } // namespace DebugStick inline static auto GMLIB_CUSTOM_ITEM_DebugStickItem = []() -> bool { - gmlib::mod::CustomItemRegistry::getInstance().registerItem(); + modapi::CustomItemRegistry::getInstance().registerItem(); return true; }(); \ No newline at end of file diff --git a/tooth.json b/tooth.json index ab0c1e1..631a990 100644 --- a/tooth.json +++ b/tooth.json @@ -2,7 +2,7 @@ "format_version": 3, "format_uuid": "289f771f-2c9a-4d73-9f3f-8492495a924d", "tooth": "github.com/GroupMountain/GMDebugStick", - "version": "1.2.0", + "version": "1.3.0", "info": { "name": "GMDebugStick", "description": "Register for a debug stick item", @@ -17,8 +17,9 @@ "label": "", "platform": "win-x64", "dependencies": { - "github.com/LiteLDev/LeviLamina": ">=1.4.0", - "github.com/GroupMountain/GMLIB-Release": ">=1.4.0" + "github.com/LiteLDev/LeviLamina": ">=1.5.0", + "github.com/GroupMountain/GMLIB-Release": ">=1.5.0", + "github.com/GroupMountain/ModAPI-Release": ">=0.1.0" }, "assets": [ { diff --git a/xmake.lua b/xmake.lua index 34f8479..13bbb10 100644 --- a/xmake.lua +++ b/xmake.lua @@ -3,9 +3,10 @@ add_rules("mode.debug", "mode.release") add_repositories("liteldev-repo https://github.com/LiteLDev/xmake-repo.git") add_repositories("groupmountain-repo https://github.com/GroupMountain/xmake-repo.git") -add_requires("levilamina 1.4.0", {configs = {target_type = "server"}}) -add_requires("levibuildscript 0.4.1") -add_requires("gmlib 1.4.0") +add_requires("levilamina 1.5.2", {configs = {target_type = "server"}}) +add_requires("levibuildscript 0.5.2") +add_requires("gmlib 1.5.2") +add_requires("modapi 0.1.1") if not has_config("vs_runtime") then set_runtimes("MD") @@ -32,7 +33,8 @@ target("DebugStick") ) add_packages( "levilamina", - "gmlib" + "gmlib", + "modapi" ) set_exceptions("none") set_kind("shared")