From 7af336e4b0d9fbf239549b2a78c7e51e44d81b3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E6=B2=90=E5=91=80?= <163636894+zimuya4153@users.noreply.github.com> Date: Sat, 20 Jul 2024 17:24:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DgetPlayerUIItem=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/GMLIB_API-JS.d.ts | 2 +- lib/GMLIB_API-JS.js | 2 +- src/CompatibilityApi.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/GMLIB_API-JS.d.ts b/lib/GMLIB_API-JS.d.ts index 7aa1c4a..ecedf22 100644 --- a/lib/GMLIB_API-JS.d.ts +++ b/lib/GMLIB_API-JS.d.ts @@ -1053,7 +1053,7 @@ interface Player { ): void; /** (GMLIB)获取玩家UI栏物品 */ - setPlayerUIItem( + getPlayerUIItem( /** 槽位 */ slot: number ): Item; diff --git a/lib/GMLIB_API-JS.js b/lib/GMLIB_API-JS.js index af2dea8..b83c7e8 100644 --- a/lib/GMLIB_API-JS.js +++ b/lib/GMLIB_API-JS.js @@ -2448,7 +2448,7 @@ LLSE_Player.prototype.setPlayerUIItem = return GMLIB_API.setPlayerUIItem(this, slot, item); } -LLSE_Player.prototype.setPlayerUIItem = +LLSE_Player.prototype.getPlayerUIItem = /** * 获取玩家UI栏物品 * @param {number} slot 格子槽位 diff --git a/src/CompatibilityApi.cpp b/src/CompatibilityApi.cpp index 02a607a..d4df1a8 100644 --- a/src/CompatibilityApi.cpp +++ b/src/CompatibilityApi.cpp @@ -865,7 +865,7 @@ void Export_Compatibility_API() { RemoteCall::exportAs("GMLIB_API", "setPlayerUIItem", [](Player* player, int slot, ItemStack const* item) -> void { player->setPlayerUIItem((PlayerUISlot)slot, *item); }); - RemoteCall::exportAs("GMLIB_API", "getPlayerUIItem", [](Player* player, int slot) -> void { - player->getPlayerUIItem((PlayerUISlot)slot); + RemoteCall::exportAs("GMLIB_API", "getPlayerUIItem", [](Player* player, int slot) -> ItemStack* { + return const_cast(&player->getPlayerUIItem((PlayerUISlot)slot)); }); } \ No newline at end of file