Compare commits
9 Commits
@@ -7,12 +7,19 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- uses: actions/checkout@v6
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- uses: xmake-io/github-action-setup-xmake@v1
|
- uses: xmake-io/github-action-setup-xmake@v1
|
||||||
|
# with:
|
||||||
|
# xmake-version: branch@master
|
||||||
|
|
||||||
|
- uses: actions/cache@v5
|
||||||
with:
|
with:
|
||||||
xmake-version: 3.0.0
|
path: |
|
||||||
|
~/AppData/Local/.xmake
|
||||||
|
key: xmake-${{ hashFiles('xmake.lua') }}
|
||||||
|
restore-keys: |
|
||||||
|
xmake-
|
||||||
|
|
||||||
- run: |
|
- run: |
|
||||||
xmake repo -u
|
xmake repo -u
|
||||||
@@ -23,7 +30,7 @@ jobs:
|
|||||||
- run: |
|
- run: |
|
||||||
xmake -w -y
|
xmake -w -y
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
|
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
|
||||||
path: |
|
path: |
|
||||||
|
|||||||
@@ -7,12 +7,20 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- uses: actions/checkout@v6
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- uses: xmake-io/github-action-setup-xmake@v1
|
- uses: xmake-io/github-action-setup-xmake@v1
|
||||||
|
# with:
|
||||||
|
# xmake-version: branch@master
|
||||||
|
|
||||||
|
- uses: actions/cache@v5
|
||||||
with:
|
with:
|
||||||
xmake-version: 3.0.0
|
path: |
|
||||||
|
~/AppData/Local/.xmake
|
||||||
|
key: xmake-${{ hashFiles('xmake.lua') }}
|
||||||
|
restore-keys: |
|
||||||
|
xmake-
|
||||||
|
|
||||||
|
|
||||||
- run: |
|
- run: |
|
||||||
xmake repo -u
|
xmake repo -u
|
||||||
@@ -23,7 +31,7 @@ jobs:
|
|||||||
- run: |
|
- run: |
|
||||||
xmake -w -y
|
xmake -w -y
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
|
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
|
||||||
path: |
|
path: |
|
||||||
@@ -37,10 +45,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Download Mod
|
- name: Download Mod
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
|
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
|
||||||
path: artifact
|
path: artifact
|
||||||
@@ -55,7 +63,7 @@ jobs:
|
|||||||
working-directory: artifact
|
working-directory: artifact
|
||||||
|
|
||||||
- name: Create GitHub Release
|
- name: Create GitHub Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v3
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
${{ github.event.repository.name }}-windows-x64.zip
|
${{ github.event.repository.name }}-windows-x64.zip
|
||||||
Vendored
+3
-3
@@ -1078,12 +1078,12 @@ export class UserCache {
|
|||||||
|
|
||||||
/** 获取玩家信息 */
|
/** 获取玩家信息 */
|
||||||
static getPlayerInfo(
|
static getPlayerInfo(
|
||||||
/** 玩家名 或 xuid 或 uuid */
|
/** 玩家名 或 xuid 或 uuid 或 serverId 或 uniqueId */
|
||||||
playerIdentifier: string
|
playerIdentifier: string
|
||||||
): { Xuid: String, Uuid: string, Name: string } | null;
|
): { Xuid: string, Uuid: string, Name: string, ServerId: string, ActorUniqueID: string } | null;
|
||||||
|
|
||||||
/** 获取所有玩家信息 */
|
/** 获取所有玩家信息 */
|
||||||
static getAllPlayerInfo(): { Xuid: String; Uuid: string; Name: string; }[]
|
static getAllPlayerInfo(): { Xuid: string, Uuid: string, Name: string, ServerId: string, ActorUniqueID: string }[]
|
||||||
}
|
}
|
||||||
|
|
||||||
type PacketDataItem = (
|
type PacketDataItem = (
|
||||||
|
|||||||
+8
-5
@@ -216,7 +216,9 @@ const GMLIB_API = {
|
|||||||
getXuidByName: ll.imports("GMLIB_API", "getXuidByName"),
|
getXuidByName: ll.imports("GMLIB_API", "getXuidByName"),
|
||||||
/** 根据名字获取uuid @type {function(string):string} */
|
/** 根据名字获取uuid @type {function(string):string} */
|
||||||
getUuidByName: ll.imports("GMLIB_API", "getUuidByName"),
|
getUuidByName: ll.imports("GMLIB_API", "getUuidByName"),
|
||||||
/** 获取所有已记录的玩家信息 @type {function():Array.<{"Uuid":string,"Xuid":string,"Name":string}>} */
|
/** 根据信息获取玩家信息 @type {function():{"Uuid":string,"Xuid":string,"Name":string,"ServerId":string,"ActorUniqueID":string}} */
|
||||||
|
getPlayerInfo: ll.imports("GMLIB_API", "getPlayerInfo"),
|
||||||
|
/** 获取所有已记录的玩家信息 @type {function():Array.<{"Uuid":string,"Xuid":string,"Name":string,"ServerId":string,"ActorUniqueID":string}>} */
|
||||||
getAllPlayerInfo: ll.imports("GMLIB_API", "getAllPlayerInfo"),
|
getAllPlayerInfo: ll.imports("GMLIB_API", "getAllPlayerInfo"),
|
||||||
/** 获取方块RuntimeId @type {function(string,number):number} */
|
/** 获取方块RuntimeId @type {function(string,number):number} */
|
||||||
getBlockRuntimeId: ll.imports("GMLIB_API", "getBlockRuntimeId"),
|
getBlockRuntimeId: ll.imports("GMLIB_API", "getBlockRuntimeId"),
|
||||||
@@ -2107,16 +2109,17 @@ class UserCache {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取玩家信息
|
* 获取玩家信息
|
||||||
* @param {string} playerIdentifier 玩家的 xuid 或 uuid 或 名称
|
* @param {string} playerIdentifier 玩家的 xuid 或 uuid 或 realName 或 serverId 或 uniqueId
|
||||||
* @returns {{Xuid: String, Uuid: string, Name: string}?} 玩家信息
|
* @returns {{Xuid: string, Uuid: string, Name: string, ServerId: string, ActorUniqueID: string}?} 玩家信息
|
||||||
*/
|
*/
|
||||||
static getPlayerInfo(playerIdentifier) {
|
static getPlayerInfo(playerIdentifier) {
|
||||||
return GMLIB_API.getAllPlayerInfo().find(Info => Object.keys(Info).some(InfoKey => Info[InfoKey] === playerIdentifier));
|
const result = GMLIB_API.getPlayerInfo(playerIdentifier)
|
||||||
|
return Object.keys(result).length === 0 ? null : result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有玩家信息
|
* 获取所有玩家信息
|
||||||
* @returns {Array.<{Xuid: String, Uuid: string, Name: string}>} 包含所有玩家信息的数组
|
* @returns {Array.<{Xuid: string, Uuid: string, Name: string, ServerId: string, ActorUniqueID: string}>} 包含所有玩家信息的数组
|
||||||
*/
|
*/
|
||||||
static getAllPlayerInfo() {
|
static getAllPlayerInfo() {
|
||||||
return GMLIB_API.getAllPlayerInfo();
|
return GMLIB_API.getAllPlayerInfo();
|
||||||
|
|||||||
+47
-25
@@ -1,4 +1,5 @@
|
|||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
|
#include "gmlib/mc/world/actor/Player.h"
|
||||||
#include "mc/platform/UUID.h"
|
#include "mc/platform/UUID.h"
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
|
||||||
@@ -442,25 +443,16 @@ void Export_Compatibility_API() {
|
|||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getWorldSpawn", []() -> std::pair<BlockPos, int> {
|
RemoteCall::exportAs("GMLIB_API", "getWorldSpawn", []() -> std::pair<BlockPos, int> {
|
||||||
constexpr static HashedString SPAWN_POS{"spawnPos"};
|
constexpr static HashedString SPAWN_POS{"spawnPos"};
|
||||||
using mUnkfc867e = std::variant<
|
|
||||||
int,
|
|
||||||
bool,
|
|
||||||
float,
|
|
||||||
std::string,
|
|
||||||
GeneratorType,
|
|
||||||
GameType,
|
|
||||||
BlockPos,
|
|
||||||
LevelSeed64,
|
|
||||||
LevelDataValue::Tag,
|
|
||||||
DaylightCycle>;
|
|
||||||
auto& levelData = GMLevel::getInstance()->getLevelData();
|
auto& levelData = GMLevel::getInstance()->getLevelData();
|
||||||
if (auto it = levelData.mValues->find(SPAWN_POS); it != levelData.mValues->end()) {
|
if (auto it = levelData.mValues->find(SPAWN_POS); it != levelData.mValues->end()) {
|
||||||
if (auto value = std::get_if<BlockPos>(&it->second.mUnkfc867e.as<mUnkfc867e>()); value) {
|
|
||||||
|
if (auto value = std::get_if<BlockPos>(&it->second.mValue.get()); value) {
|
||||||
return {*value, 0};
|
return {*value, 0};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (auto it = levelData.mOverrides->find(SPAWN_POS); it != levelData.mOverrides->end()) {
|
if (auto it = levelData.mOverrides->find(SPAWN_POS); it != levelData.mOverrides->end()) {
|
||||||
if (auto value = std::get_if<BlockPos>(&it->second.mUnkfc867e.as<mUnkfc867e>()); value) {
|
if (auto value = std::get_if<BlockPos>(&it->second.mValue.get()); value) {
|
||||||
return {*value, 0};
|
return {*value, 0};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -470,7 +462,8 @@ void Export_Compatibility_API() {
|
|||||||
if (pos.second != 0) return false;
|
if (pos.second != 0) return false;
|
||||||
GMLevel::getInstance()->getLevelData().setSpawnPos(pos.first);
|
GMLevel::getInstance()->getLevelData().setSpawnPos(pos.first);
|
||||||
auto pkt = SetSpawnPositionPacket();
|
auto pkt = SetSpawnPositionPacket();
|
||||||
pkt.mSpawnBlockPos = NetworkBlockPosition(pos.first);
|
pkt.mSpawnBlockPos = pos.first;
|
||||||
|
|
||||||
pkt.mDimensionType = 0;
|
pkt.mDimensionType = 0;
|
||||||
pkt.mSpawnPosType = SpawnPositionType::WorldSpawn;
|
pkt.mSpawnPosType = SpawnPositionType::WorldSpawn;
|
||||||
pkt.sendToClients();
|
pkt.sendToClients();
|
||||||
@@ -503,7 +496,7 @@ void Export_Compatibility_API() {
|
|||||||
return "";
|
return "";
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getXuidByName", [](std::string const& name) -> std::string {
|
RemoteCall::exportAs("GMLIB_API", "getXuidByName", [](std::string const& name) -> std::string {
|
||||||
if (auto uce = UserCache::getInstance()->from(name, UserCache::QueryType::Name)) {
|
if (auto uce = UserCache::getInstance()->from(name, UserCache::Name)) {
|
||||||
return uce->mXuid;
|
return uce->mXuid;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
@@ -515,34 +508,63 @@ void Export_Compatibility_API() {
|
|||||||
return "";
|
return "";
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getNameByXuid", [](std::string const& xuid) -> std::string {
|
RemoteCall::exportAs("GMLIB_API", "getNameByXuid", [](std::string const& xuid) -> std::string {
|
||||||
if (auto uce = UserCache::getInstance()->from(xuid, UserCache::QueryType::Xuid)) {
|
if (auto uce = UserCache::getInstance()->from(xuid, UserCache::Xuid)) {
|
||||||
return uce->mName;
|
return uce->mName;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getUuidByXuid", [](std::string const& xuid) -> std::string {
|
RemoteCall::exportAs("GMLIB_API", "getUuidByXuid", [](std::string const& xuid) -> std::string {
|
||||||
if (auto uce = UserCache::getInstance()->from(xuid, UserCache::QueryType::Xuid)) {
|
if (auto uce = UserCache::getInstance()->from(xuid, UserCache::Xuid)) {
|
||||||
return uce->mUuid.asString();
|
return uce->mUuid.asString();
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getUuidByName", [](std::string const& name) -> std::string {
|
RemoteCall::exportAs("GMLIB_API", "getUuidByName", [](std::string const& name) -> std::string {
|
||||||
if (auto uce = UserCache::getInstance()->from(name, UserCache::QueryType::Name)) {
|
if (auto uce = UserCache::getInstance()->from(name, UserCache::Name)) {
|
||||||
return uce->mUuid.asString();
|
return uce->mUuid.asString();
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
});
|
});
|
||||||
|
RemoteCall::exportAs(
|
||||||
|
"GMLIB_API",
|
||||||
|
"getPlayerInfo",
|
||||||
|
[](std::string const& info) -> std::unordered_map<std::string, std::string> {
|
||||||
|
// TODO: 下个GMLIB更新直接改成from(info, UserCache::QueryType::All)
|
||||||
|
std::unordered_map<std::string, std::string> result;
|
||||||
|
if (auto uce = UserCache::getInstance()->from(mce::UUID::fromString(info))) {
|
||||||
|
ll::reflection::forEachMember(*uce, [&](std::string_view name, auto&& member) {
|
||||||
|
result[std::string{name.substr(1)}] = fmt::to_string(member);
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (auto uniqeuId = ll::string_utils::svtoll(info); uniqeuId) {
|
||||||
|
if (auto uce = UserCache::getInstance()->from(ActorUniqueID{*uniqeuId})) {
|
||||||
|
ll::reflection::forEachMember(*uce, [&](std::string_view name, auto&& member) {
|
||||||
|
result[std::string{name.substr(1)}] = fmt::to_string(member);
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (auto uce = UserCache::getInstance()->from(info, UserCache::Default)) {
|
||||||
|
ll::reflection::forEachMember(*uce, [&](std::string_view name, auto&& member) {
|
||||||
|
result[std::string{name.substr(1)}] = fmt::to_string(member);
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
);
|
||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
"GMLIB_API",
|
"GMLIB_API",
|
||||||
"getAllPlayerInfo",
|
"getAllPlayerInfo",
|
||||||
[]() -> std::vector<std::unordered_map<std::string, std::string>> {
|
[]() -> std::vector<std::unordered_map<std::string, std::string>> {
|
||||||
std::vector<std::unordered_map<std::string, std::string>> result;
|
std::vector<std::unordered_map<std::string, std::string>> result;
|
||||||
for (auto entry : UserCache::getInstance()->entries()) {
|
for (auto& entry : UserCache::getInstance()->entries()) {
|
||||||
result.push_back({
|
std::unordered_map<std::string, std::string> item;
|
||||||
{"Name", entry.mName },
|
ll::reflection::forEachMember(entry, [&](std::string_view name, auto&& member) {
|
||||||
{"Xuid", entry.mXuid },
|
item[std::string{name.substr(1)}] = fmt::to_string(member);
|
||||||
{"Uuid", entry.mUuid.asString()}
|
|
||||||
});
|
});
|
||||||
|
result.emplace_back(std::move(item));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -722,7 +744,7 @@ void Export_Compatibility_API() {
|
|||||||
return entity->getNameTag();
|
return entity->getNameTag();
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "ItemisUnbreakable", [](ItemStack const* item) -> bool {
|
RemoteCall::exportAs("GMLIB_API", "ItemisUnbreakable", [](ItemStack const* item) -> bool {
|
||||||
return ((GMItemStack*)item)->isUnbreakable();
|
return ((GMItemStack*)item)->getUnbreakable();
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "setItemUnbreakable", [](ItemStack const* item, bool value) -> void {
|
RemoteCall::exportAs("GMLIB_API", "setItemUnbreakable", [](ItemStack const* item, bool value) -> void {
|
||||||
((GMItemStack*)item)->setUnbreakable(value);
|
((GMItemStack*)item)->setUnbreakable(value);
|
||||||
@@ -794,7 +816,7 @@ void Export_Compatibility_API() {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
RemoteCall::exportAs("GMLIB_API", "getPlayerHungry", [](Player* player) -> float {
|
RemoteCall::exportAs("GMLIB_API", "getPlayerHungry", [](Player* player) -> float {
|
||||||
return player->getMutableAttribute(Player::HUNGER()).mInstance->mCurrentValue;
|
return player->getAttribute(Player::HUNGER()).mPtr->mCurrentValue;
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getPlayerArmorCoverPercentage", [](Player* player) -> float {
|
RemoteCall::exportAs("GMLIB_API", "getPlayerArmorCoverPercentage", [](Player* player) -> float {
|
||||||
return player->getArmorCoverPercentage();
|
return player->getArmorCoverPercentage();
|
||||||
|
|||||||
+17
-4
@@ -3,9 +3,6 @@
|
|||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4996)
|
#pragma warning(disable : 4996)
|
||||||
#pragma include_alias("mc/world/item/HumanoidArmorItem.h", "modapi/item/types/mc/HumanoidArmorItem.h")
|
#pragma include_alias("mc/world/item/HumanoidArmorItem.h", "modapi/item/types/mc/HumanoidArmorItem.h")
|
||||||
#pragma include_alias("mc/world/level/block/states/BuiltInBlockStateVariant.h", "mc/BuiltInBlockStateVariant.h")
|
|
||||||
#pragma include_alias("mc/world/events/EventCoordinatorPimpl.h", "mc/EventCoordinatorPimpl.h")
|
|
||||||
#pragma include_alias("mc/world/events/PlayerNotificationEvent.h", "mc/PlayerNotificationEvent.h")
|
|
||||||
#include <gmlib/include_ll.h>
|
#include <gmlib/include_ll.h>
|
||||||
#include <gmlib/include_lib.h>
|
#include <gmlib/include_lib.h>
|
||||||
#include <gmlib/include_mc.h>
|
#include <gmlib/include_mc.h>
|
||||||
@@ -25,7 +22,7 @@ using namespace modapi;
|
|||||||
#define PLUGIN_NAME fmt::format(fg(fmt::color::light_green), "GMLIB-LRCA")
|
#define PLUGIN_NAME fmt::format(fg(fmt::color::light_green), "GMLIB-LRCA")
|
||||||
|
|
||||||
#define LIB_VERSION_MAJOR 1
|
#define LIB_VERSION_MAJOR 1
|
||||||
#define LIB_VERSION_MINOR 6
|
#define LIB_VERSION_MINOR 8
|
||||||
#define LIB_VERSION_PATCH 0
|
#define LIB_VERSION_PATCH 0
|
||||||
#define LIB_VERSION_PRERELEASE std::nullopt
|
#define LIB_VERSION_PRERELEASE std::nullopt
|
||||||
|
|
||||||
@@ -44,3 +41,19 @@ extern void Export_BinaryStream_API();
|
|||||||
extern ll::thread::ThreadPoolExecutor const& getThreadPoolExecutor();
|
extern ll::thread::ThreadPoolExecutor const& getThreadPoolExecutor();
|
||||||
extern ll::io::Logger& getLogger();
|
extern ll::io::Logger& getLogger();
|
||||||
// extern void Export_Form_API();
|
// extern void Export_Form_API();
|
||||||
|
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct fmt::formatter<ActorUniqueID> : fmt::formatter<int64> {
|
||||||
|
template <class FormatContext>
|
||||||
|
auto format(ActorUniqueID const& t, FormatContext& ctx) const {
|
||||||
|
return formatter<int64>::format(t.rawID, ctx);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
template <>
|
||||||
|
struct fmt::formatter<mce::UUID> : fmt::formatter<std::string> {
|
||||||
|
template <class FormatContext>
|
||||||
|
auto format(mce::UUID const& t, FormatContext& ctx) const {
|
||||||
|
return formatter<std::string>::format(t.asString(), ctx);
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "mc/_HeaderOutputPredefine.h"
|
|
||||||
#include "mc/world/level/block/states/BlockStateVariant.h"
|
|
||||||
|
|
||||||
template <typename T0>
|
|
||||||
class BuiltInBlockStateVariant : public ::BlockStateVariant<T0> {
|
|
||||||
public:
|
|
||||||
// virtual functions
|
|
||||||
// NOLINTBEGIN
|
|
||||||
// vIndex: 0
|
|
||||||
virtual ~BuiltInBlockStateVariant() /*override*/ = default;
|
|
||||||
// NOLINTEND
|
|
||||||
};
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "mc/_HeaderOutputPredefine.h"
|
|
||||||
#include "mc/deps/core/utility/EnableNonOwnerReferences.h"
|
|
||||||
#include "mc/world/events/EventResult.h"
|
|
||||||
|
|
||||||
template <class T0>
|
|
||||||
class EventCoordinatorPimpl : Bedrock::EnableNonOwnerReferences {
|
|
||||||
public:
|
|
||||||
using EventFuncPtr = std::function<EventResult(T0&)>;
|
|
||||||
|
|
||||||
std::vector<T0*> mListeners;
|
|
||||||
std::vector<EventFuncPtr> mEventsToProcess;
|
|
||||||
std::vector<T0*> mPendingRegistrations;
|
|
||||||
bool mHasPendingRegistrations;
|
|
||||||
std::thread::id mThreadId;
|
|
||||||
bool mThreadIdInitialized;
|
|
||||||
uint mThreadCheckIndex;
|
|
||||||
|
|
||||||
// // ServerInstanceEventListener
|
|
||||||
// virtual ~EventCoordinatorPimpl();
|
|
||||||
|
|
||||||
// // ServerInstanceEventListener
|
|
||||||
// MCAPI bool registerListener(gsl::not_null<T0*>);
|
|
||||||
|
|
||||||
// // ScriptingEventListener
|
|
||||||
// MCAPI void processEvent(EventFuncPtr);
|
|
||||||
|
|
||||||
// // ActorEventListener
|
|
||||||
// MCAPI void unregisterListener(gsl::not_null<T0*>);
|
|
||||||
};
|
|
||||||
@@ -1,139 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "mc/_HeaderOutputPredefine.h"
|
|
||||||
#include "mc/world/events/PlayerAddEvent.h"
|
|
||||||
#include "mc/world/events/PlayerAddExpEvent.h"
|
|
||||||
#include "mc/world/events/PlayerAddLevelEvent.h"
|
|
||||||
#include "mc/world/events/PlayerArmorExchangeEvent.h"
|
|
||||||
#include "mc/world/events/PlayerDamageEvent.h"
|
|
||||||
#include "mc/world/events/PlayerDestroyBlockEvent.h"
|
|
||||||
#include "mc/world/events/PlayerDimensionChangeAfterEvent.h"
|
|
||||||
#include "mc/world/events/PlayerDimensionChangeBeforeEvent.h"
|
|
||||||
#include "mc/world/events/PlayerDisconnectEvent.h"
|
|
||||||
#include "mc/world/events/PlayerDropItemEvent.h"
|
|
||||||
#include "mc/world/events/PlayerEatFoodEvent.h"
|
|
||||||
#include "mc/world/events/PlayerEmoteEvent.h"
|
|
||||||
#include "mc/world/events/PlayerFormCloseEvent.h"
|
|
||||||
#include "mc/world/events/PlayerFormResponseEvent.h"
|
|
||||||
#include "mc/world/events/PlayerGameModeChangeEvent.h"
|
|
||||||
#include "mc/world/events/PlayerGetExperienceOrbEvent.h"
|
|
||||||
#include "mc/world/events/PlayerInitialSpawnEvent.h"
|
|
||||||
#include "mc/world/events/PlayerInputModeChangeEvent.h"
|
|
||||||
#include "mc/world/events/PlayerInputPermissionCategoryChangeEvent.h"
|
|
||||||
#include "mc/world/events/PlayerInteractEvent.h"
|
|
||||||
#include "mc/world/events/PlayerInteractWithBlockAfterEvent.h"
|
|
||||||
#include "mc/world/events/PlayerInteractWithBlockBeforeEvent.h"
|
|
||||||
#include "mc/world/events/PlayerInteractWithEntityAfterEvent.h"
|
|
||||||
#include "mc/world/events/PlayerInteractWithEntityBeforeEvent.h"
|
|
||||||
#include "mc/world/events/PlayerOpenContainerEvent.h"
|
|
||||||
#include "mc/world/events/PlayerRespawnEvent.h"
|
|
||||||
#include "mc/world/events/PlayerSayCommandEvent.h"
|
|
||||||
#include "mc/world/events/PlayerScriptInputEvent.h"
|
|
||||||
#include "mc/world/events/PlayerSelectedItemChangedEvent.h"
|
|
||||||
#include "mc/world/events/PlayerShootArrowEvent.h"
|
|
||||||
#include "mc/world/events/PlayerSkinLoadedClientEvent.h"
|
|
||||||
#include "mc/world/events/PlayerSleepStateChangeEvent.h"
|
|
||||||
#include "mc/world/events/PlayerStopLoadingEvent.h"
|
|
||||||
#include "mc/world/events/PlayerSwingStartEvent.h"
|
|
||||||
#include "mc/world/events/PlayerUpdateInteractionEvent.h"
|
|
||||||
#include "mc/world/events/PlayerUseNameTagEvent.h"
|
|
||||||
|
|
||||||
|
|
||||||
// auto generated inclusion list
|
|
||||||
#include "mc/world/events/EventVariantImpl.h"
|
|
||||||
|
|
||||||
// auto generated forward declare list
|
|
||||||
// clang-format off
|
|
||||||
struct PlayerAddEvent;
|
|
||||||
struct PlayerAddExpEvent;
|
|
||||||
struct PlayerAddLevelEvent;
|
|
||||||
struct PlayerArmorExchangeEvent;
|
|
||||||
struct PlayerCloseContainerEvent;
|
|
||||||
struct PlayerDamageEvent;
|
|
||||||
struct PlayerDestroyBlockEvent;
|
|
||||||
struct PlayerDimensionChangeAfterEvent;
|
|
||||||
struct PlayerDimensionChangeBeforeEvent;
|
|
||||||
struct PlayerDisconnectEvent;
|
|
||||||
struct PlayerDropItemEvent;
|
|
||||||
struct PlayerEatFoodEvent;
|
|
||||||
struct PlayerEmoteEvent;
|
|
||||||
struct PlayerFormCloseEvent;
|
|
||||||
struct PlayerFormResponseEvent;
|
|
||||||
struct PlayerGameModeChangeEvent;
|
|
||||||
struct PlayerGetExperienceOrbEvent;
|
|
||||||
struct PlayerHotbarSelectedSlotChangeEvent;
|
|
||||||
struct PlayerInitialSpawnEvent;
|
|
||||||
struct PlayerInputModeChangeEvent;
|
|
||||||
struct PlayerInputPermissionCategoryChangeEvent;
|
|
||||||
struct PlayerInteractEvent;
|
|
||||||
struct PlayerInteractWithBlockAfterEvent;
|
|
||||||
struct PlayerInteractWithBlockBeforeEvent;
|
|
||||||
struct PlayerInteractWithEntityAfterEvent;
|
|
||||||
struct PlayerInteractWithEntityBeforeEvent;
|
|
||||||
struct PlayerInventoryItemChangeEvent;
|
|
||||||
struct PlayerOpenContainerEvent;
|
|
||||||
struct PlayerRespawnEvent;
|
|
||||||
struct PlayerSayCommandEvent;
|
|
||||||
struct PlayerScriptInputEvent;
|
|
||||||
struct PlayerSelectedItemChangedEvent;
|
|
||||||
struct PlayerShootArrowEvent;
|
|
||||||
struct PlayerSkinLoadedClientEvent;
|
|
||||||
struct PlayerSleepStateChangeEvent;
|
|
||||||
struct PlayerStopLoadingEvent;
|
|
||||||
struct PlayerSwingStartEvent;
|
|
||||||
struct PlayerUpdateInteractionEvent;
|
|
||||||
struct PlayerUseNameTagEvent;
|
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
struct PlayerNotificationEvent : public ::EventVariantImpl<
|
|
||||||
::PlayerSkinLoadedClientEvent const,
|
|
||||||
::PlayerAddEvent const,
|
|
||||||
::PlayerAddExpEvent const,
|
|
||||||
::PlayerAddLevelEvent const,
|
|
||||||
::PlayerArmorExchangeEvent const,
|
|
||||||
::PlayerDestroyBlockEvent const,
|
|
||||||
::PlayerUseNameTagEvent const,
|
|
||||||
::PlayerDropItemEvent const,
|
|
||||||
::PlayerEatFoodEvent const,
|
|
||||||
::PlayerDamageEvent const,
|
|
||||||
::PlayerDisconnectEvent const,
|
|
||||||
::PlayerFormCloseEvent const,
|
|
||||||
::PlayerFormResponseEvent const,
|
|
||||||
::PlayerInputModeChangeEvent const,
|
|
||||||
::PlayerInitialSpawnEvent const,
|
|
||||||
::PlayerOpenContainerEvent const,
|
|
||||||
::PlayerCloseContainerEvent const,
|
|
||||||
::PlayerShootArrowEvent const,
|
|
||||||
::PlayerSwingStartEvent const,
|
|
||||||
::PlayerRespawnEvent const,
|
|
||||||
::PlayerSleepStateChangeEvent const,
|
|
||||||
::PlayerStopLoadingEvent const,
|
|
||||||
::PlayerUpdateInteractionEvent const,
|
|
||||||
::PlayerSelectedItemChangedEvent const,
|
|
||||||
::PlayerDimensionChangeBeforeEvent const,
|
|
||||||
::PlayerDimensionChangeAfterEvent const,
|
|
||||||
::PlayerInteractWithEntityAfterEvent const,
|
|
||||||
::PlayerInteractWithBlockAfterEvent const,
|
|
||||||
::PlayerEmoteEvent const,
|
|
||||||
::PlayerScriptInputEvent const,
|
|
||||||
::PlayerInventoryItemChangeEvent const,
|
|
||||||
::PlayerHotbarSelectedSlotChangeEvent const,
|
|
||||||
::PlayerInputPermissionCategoryChangeEvent const,
|
|
||||||
::PlayerSayCommandEvent const,
|
|
||||||
::PlayerGetExperienceOrbEvent const,
|
|
||||||
::PlayerInteractEvent const,
|
|
||||||
::PlayerInteractWithEntityBeforeEvent const,
|
|
||||||
::PlayerInteractWithBlockBeforeEvent const,
|
|
||||||
::PlayerGameModeChangeEvent const> {
|
|
||||||
public:
|
|
||||||
// member functions
|
|
||||||
// NOLINTBEGIN
|
|
||||||
MCAPI ~PlayerNotificationEvent();
|
|
||||||
// NOLINTEND
|
|
||||||
|
|
||||||
public:
|
|
||||||
// destructor thunk
|
|
||||||
// NOLINTBEGIN
|
|
||||||
MCAPI void $dtor();
|
|
||||||
// NOLINTEND
|
|
||||||
};
|
|
||||||
+5
-5
@@ -2,7 +2,7 @@
|
|||||||
"format_version": 3,
|
"format_version": 3,
|
||||||
"format_uuid": "289f771f-2c9a-4d73-9f3f-8492495a924d",
|
"format_uuid": "289f771f-2c9a-4d73-9f3f-8492495a924d",
|
||||||
"tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi",
|
"tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi",
|
||||||
"version": "1.7.0",
|
"version": "1.10.0",
|
||||||
"info": {
|
"info": {
|
||||||
"name": "GMLIB-LegacyRemoteCallApi",
|
"name": "GMLIB-LegacyRemoteCallApi",
|
||||||
"description": "Legacy RemoteCall API for GMLIB",
|
"description": "Legacy RemoteCall API for GMLIB",
|
||||||
@@ -19,10 +19,10 @@
|
|||||||
{
|
{
|
||||||
"platform": "win-x64",
|
"platform": "win-x64",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"github.com/LiteLDev/LeviLamina": ">=1.7.0",
|
"github.com/LiteLDev/LeviLamina": ">=26.10.0",
|
||||||
"github.com/GroupMountain/GMLIB-Release": ">=1.7.0",
|
"github.com/GroupMountain/GMLIB-Release": ">=26.10.0",
|
||||||
"github.com/GroupMountain/ModAPI-Release": ">=0.3.0",
|
"github.com/GroupMountain/ModAPI-Release": ">=26.10.0",
|
||||||
"github.com/MiracleForest/iListenAttentively-Release": ">=0.10.0"
|
"github.com/MiracleForest/iListenAttentively-Release": ">=0.12.0"
|
||||||
},
|
},
|
||||||
"assets": [
|
"assets": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,12 +8,18 @@ if not has_config("vs_runtime") then
|
|||||||
set_runtimes("MD")
|
set_runtimes("MD")
|
||||||
end
|
end
|
||||||
|
|
||||||
add_requires("levilamina 1.7.1", {configs = {target_type = "server"}})
|
add_requires("levilamina 26.10.5", {configs = {target_type = "server"}})
|
||||||
add_requires("legacyremotecall")
|
add_requires("legacyremotecall")
|
||||||
add_requires("levibuildscript 0.5.2")
|
add_requires("levibuildscript 0.6.0")
|
||||||
add_requires("ilistenattentively 0.10.0")
|
add_requires("ilistenattentively 0.12.0")
|
||||||
add_requires("gmlib 1.7.00")
|
add_requires("gmlib 26.10.0")
|
||||||
add_requires("modapi 0.3.0")
|
add_requires("modapi 26.10.0")
|
||||||
|
|
||||||
|
rule("package_envs")
|
||||||
|
before_link(function (target)
|
||||||
|
os.addenvs(target:pkgenvs())
|
||||||
|
end)
|
||||||
|
rule_end()
|
||||||
|
|
||||||
target("GMLIB-LegacyRemoteCallApi")
|
target("GMLIB-LegacyRemoteCallApi")
|
||||||
add_cxflags(
|
add_cxflags(
|
||||||
@@ -26,6 +32,7 @@ target("GMLIB-LegacyRemoteCallApi")
|
|||||||
"UNICODE",
|
"UNICODE",
|
||||||
"_HAS_CXX23=1"
|
"_HAS_CXX23=1"
|
||||||
)
|
)
|
||||||
|
add_defines("LL_PLAT_S") --TODO: check client compatibility
|
||||||
add_files(
|
add_files(
|
||||||
"src/**.cpp"
|
"src/**.cpp"
|
||||||
)
|
)
|
||||||
@@ -35,10 +42,12 @@ target("GMLIB-LegacyRemoteCallApi")
|
|||||||
add_packages(
|
add_packages(
|
||||||
"levilamina",
|
"levilamina",
|
||||||
"legacyremotecall",
|
"legacyremotecall",
|
||||||
|
"levibuildscript",
|
||||||
"ilistenattentively",
|
"ilistenattentively",
|
||||||
"gmlib",
|
"gmlib",
|
||||||
"modapi"
|
"modapi"
|
||||||
)
|
)
|
||||||
|
add_rules("package_envs")
|
||||||
add_rules("@levibuildscript/linkrule")
|
add_rules("@levibuildscript/linkrule")
|
||||||
add_rules("@levibuildscript/modpacker")
|
add_rules("@levibuildscript/modpacker")
|
||||||
set_exceptions("none")
|
set_exceptions("none")
|
||||||
|
|||||||
Reference in New Issue
Block a user