adapt: adapt LeviLamina 1.0.0-rc.3

This commit is contained in:
子沐呀
2025-01-12 20:32:24 +08:00
Unverified
parent 6e57f87129
commit 846575f83d
13 changed files with 77 additions and 131 deletions
-6
View File
@@ -1717,9 +1717,6 @@ interface Block {
/** (GMLIB) */ /** (GMLIB) */
canDropWithAnyTool(): boolean; canDropWithAnyTool(): boolean;
/** (GMLIB)方块是否不需要工具采集 */
isAlwaysDestroyable(): boolean;
/** (GMLIB)检测方块是否能被玩家挖掘(比如插件拦截) */ /** (GMLIB)检测方块是否能被玩家挖掘(比如插件拦截) */
playerWillDestroy( playerWillDestroy(
/** 挖掘的玩家对象 */ /** 挖掘的玩家对象 */
@@ -1758,9 +1755,6 @@ interface Item {
block: Block block: Block
): boolean; ): boolean;
/** (GMLIB)获取物品可以拥有的附魔 */
getLegalEnchants(): string[]
/** (GMLIB)添加附魔 */ /** (GMLIB)添加附魔 */
applyEnchant( applyEnchant(
/** 附魔的命名空间ID */ /** 附魔的命名空间ID */
-22
View File
@@ -252,8 +252,6 @@ const GMLIB_API = {
itemCanDestroySpecial: ll.import("GMLIB_API", "itemCanDestroySpecial"), itemCanDestroySpecial: ll.import("GMLIB_API", "itemCanDestroySpecial"),
/** @type {function(Block):boolean} */ /** @type {function(Block):boolean} */
blockCanDropWithAnyTool: ll.import("GMLIB_API", "blockCanDropWithAnyTool"), blockCanDropWithAnyTool: ll.import("GMLIB_API", "blockCanDropWithAnyTool"),
/** 方块是否不需要工具采集 @type {function(Block):boolean} */
blockIsAlwaysDestroyable: ll.import("GMLIB_API", "blockIsAlwaysDestroyable"),
/** @type {function(Block,Player,IntPos):boolean} */ /** @type {function(Block,Player,IntPos):boolean} */
blockPlayerWillDestroy: ll.import("GMLIB_API", "blockPlayerWillDestroy"), blockPlayerWillDestroy: ll.import("GMLIB_API", "blockPlayerWillDestroy"),
/** 使玩家攻击实体 @type {function(Entity,Player):boolean} */ /** 使玩家攻击实体 @type {function(Entity,Player):boolean} */
@@ -268,8 +266,6 @@ const GMLIB_API = {
getBlockLightEmission: ll.import("GMLIB_API", "getBlockLightEmission"), getBlockLightEmission: ll.import("GMLIB_API", "getBlockLightEmission"),
/** 获取游戏规则列表 @type {function():Array.<{Name:string,Value:string,Type:"Bool"|"Float"|"Int"}>} */ /** 获取游戏规则列表 @type {function():Array.<{Name:string,Value:string,Type:"Bool"|"Float"|"Int"}>} */
getGameRules: ll.import("GMLIB_API", "getGameRules"), getGameRules: ll.import("GMLIB_API", "getGameRules"),
/** 获取物品可以拥有的附魔 @type {function(Item):Array.<string>} */
getLegalEnchants: ll.import("GMLIB_API", "getLegalEnchants"),
/** 给物品添加附魔 @type {function(Item,string,number,boolean):boolean} */ /** 给物品添加附魔 @type {function(Item,string,number,boolean):boolean} */
applyEnchant: ll.import("GMLIB_API", "applyEnchant"), applyEnchant: ll.import("GMLIB_API", "applyEnchant"),
/** 删除物品所有附魔 @type {function(Item):void} */ /** 删除物品所有附魔 @type {function(Item):void} */
@@ -2719,15 +2715,6 @@ LLSE_Block.prototype.canDropWithAnyTool =
return GMLIB_API.blockCanDropWithAnyTool(this); return GMLIB_API.blockCanDropWithAnyTool(this);
}; };
LLSE_Block.prototype.isAlwaysDestroyable =
/**
* 方块是否不需要工具采集
* @returns {boolean} 方块是否不需要工具采集
*/
function () {
return GMLIB_API.blockIsAlwaysDestroyable(this);
};
LLSE_Block.prototype.playerWillDestroy = LLSE_Block.prototype.playerWillDestroy =
/** /**
* 检测方块是否能被玩家挖掘(比如插件拦截) * 检测方块是否能被玩家挖掘(比如插件拦截)
@@ -2758,15 +2745,6 @@ LLSE_Player.prototype.pullInEntity =
return GMLIB_API.playerPullInEntity(this, entity); return GMLIB_API.playerPullInEntity(this, entity);
}; };
LLSE_Item.prototype.getLegalEnchants =
/**
* 获取物品可以拥有的合法附魔
* @returns {Array.<string>} 附魔ID列表
*/
function () {
return GMLIB_API.getLegalEnchants(this);
};
LLSE_Item.prototype.applyEnchant = LLSE_Item.prototype.applyEnchant =
/** /**
* 添加附魔 * 添加附魔
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "${pluginName}", "name": "${pluginName}",
"entry": "${pluginFile}", "entry": "${pluginFile}",
"version": "0.13.4", "version": "0.13.5",
"author": "GroupMountain", "author": "GroupMountain",
"type": "native", "type": "native",
"passive": true, "passive": true,
+1 -1
View File
@@ -15,7 +15,7 @@ public:
auto nextId = getNextId(); auto nextId = getNextId();
cretateBinaryStream(nextId); cretateBinaryStream(nextId);
if(auto bs = getBinaryStream(nextId); bs !=nullptr){ if(auto bs = getBinaryStream(nextId); bs !=nullptr){
*getBinaryStream(nextId)->mBuffer = *getBinaryStream(id)->mBuffer; getBinaryStream(nextId)->mBuffer = getBinaryStream(id)->mBuffer;
} }
return nextId; return nextId;
} }
+39 -28
View File
@@ -1,3 +1,4 @@
#include "GMLIB/Mod/CustomRecipe/CustomRecipe.h"
#include "Global.h" #include "Global.h"
#include <regex> #include <regex>
@@ -7,7 +8,7 @@ bool isInteger(const std::string& str) {
} }
ActorUniqueID parseScriptUniqueID(std::string const& uniqueId) { ActorUniqueID parseScriptUniqueID(std::string const& uniqueId) {
return isInteger(uniqueId) ? ActorUniqueID(std::stoll(uniqueId)) : ActorUniqueID::INVALID_ID; return isInteger(uniqueId) ? ActorUniqueID(std::stoll(uniqueId)) : ActorUniqueID::INVALID_ID();
} }
void Export_Compatibility_API() { void Export_Compatibility_API() {
@@ -394,7 +395,7 @@ void Export_Compatibility_API() {
RemoteCall::exportAs("GMLIB_API", "getAllScoreboardEntities", []() -> std::vector<std::string> { RemoteCall::exportAs("GMLIB_API", "getAllScoreboardEntities", []() -> std::vector<std::string> {
std::vector<std::string> result; std::vector<std::string> result;
for (auto& uniqueId : GMLIB_Scoreboard::getInstance()->getAllEntities()) { for (auto& uniqueId : GMLIB_Scoreboard::getInstance()->getAllEntities()) {
result.push_back(std::to_string(uniqueId.id)); result.push_back(std::to_string(uniqueId.rawID));
} }
return result; return result;
}); });
@@ -418,7 +419,7 @@ void Export_Compatibility_API() {
for (auto& uniqueId : GMLIB_Scoreboard::getInstance()->getAllEntities()) { for (auto& uniqueId : GMLIB_Scoreboard::getInstance()->getAllEntities()) {
result.push_back({ result.push_back({
{"Type", "Entity" }, {"Type", "Entity" },
{"UniqueId", std::to_string(uniqueId.id)} {"UniqueId", std::to_string(uniqueId.rawID)}
}); });
} }
return result; return result;
@@ -431,7 +432,7 @@ void Export_Compatibility_API() {
return ll::service::getLevel()->getPlayer(parseScriptUniqueID(uniqueId)); return ll::service::getLevel()->getPlayer(parseScriptUniqueID(uniqueId));
}); });
RemoteCall::exportAs("GMLIB_API", "getEntityFromUniqueId", [](std::string const& uniqueId) -> Actor* { RemoteCall::exportAs("GMLIB_API", "getEntityFromUniqueId", [](std::string const& uniqueId) -> Actor* {
return ll::service::getLevel()->fetchEntity(parseScriptUniqueID(uniqueId)); return ll::service::getLevel()->fetchEntity(parseScriptUniqueID(uniqueId), false);
}); });
RemoteCall::exportAs("GMLIB_API", "getWorldSpawn", []() -> std::pair<BlockPos, int> { RemoteCall::exportAs("GMLIB_API", "getWorldSpawn", []() -> std::pair<BlockPos, int> {
return {GMLIB_Level::getInstance()->getWorldSpawn(), 0}; return {GMLIB_Level::getInstance()->getWorldSpawn(), 0};
@@ -555,10 +556,7 @@ void Export_Compatibility_API() {
return item->canDestroySpecial(*block); return item->canDestroySpecial(*block);
}); });
RemoteCall::exportAs("GMLIB_API", "blockCanDropWithAnyTool", [](Block const* block) -> bool { RemoteCall::exportAs("GMLIB_API", "blockCanDropWithAnyTool", [](Block const* block) -> bool {
return block->canDropWithAnyTool(); return !block->requiresCorrectToolForDrops();
});
RemoteCall::exportAs("GMLIB_API", "blockIsAlwaysDestroyable", [](Block const* block) -> bool {
return block->getMaterial().isAlwaysDestroyable();
}); });
RemoteCall::exportAs( RemoteCall::exportAs(
"GMLIB_API", "GMLIB_API",
@@ -583,7 +581,7 @@ void Export_Compatibility_API() {
"getBlockLightEmission", "getBlockLightEmission",
[](std::string const& blockName, short legacyData) -> char { [](std::string const& blockName, short legacyData) -> char {
return Block::tryGetFromRegistry(blockName) return Block::tryGetFromRegistry(blockName)
.transform([](const Block& block) -> char { return (char)block.getLightEmission().value; }) .transform([](const Block& block) -> char { return (char)block.getLightEmission().mValue; })
.value_or(-1); .value_or(-1);
} }
); );
@@ -622,13 +620,6 @@ void Export_Compatibility_API() {
return result; return result;
} }
); );
RemoteCall::exportAs("GMLIB_API", "getLegalEnchants", [](ItemStack const* item) -> std::vector<std::string> {
std::vector<std::string> result;
for (auto& enchant : EnchantUtils::getLegalEnchants(item->getItem())) {
result.push_back(Enchant::getEnchant((Enchant::Type)enchant)->getStringId());
}
return result;
});
RemoteCall::exportAs("GMLIB_API", "getEnchantTypeNameFromId", [](int id) -> std::string { RemoteCall::exportAs("GMLIB_API", "getEnchantTypeNameFromId", [](int id) -> std::string {
if (auto enchant = Enchant::getEnchant((Enchant::Type)id)) { if (auto enchant = Enchant::getEnchant((Enchant::Type)id)) {
return std::string(enchant->getStringId()); return std::string(enchant->getStringId());
@@ -669,10 +660,10 @@ void Export_Compatibility_API() {
[](Player* player, ItemStack const* item, bool randomly) -> bool { return player->drop(*item, randomly); } [](Player* player, ItemStack const* item, bool randomly) -> bool { return player->drop(*item, randomly); }
); );
RemoteCall::exportAs("GMLIB_API", "getPlayerRuntimeId", [](Player* player) -> uint64 { RemoteCall::exportAs("GMLIB_API", "getPlayerRuntimeId", [](Player* player) -> uint64 {
return player->getRuntimeID().id; return player->getRuntimeID().rawID;
}); });
RemoteCall::exportAs("GMLIB_API", "getEntityRuntimeId", [](Actor* entity) -> uint64 { RemoteCall::exportAs("GMLIB_API", "getEntityRuntimeId", [](Actor* entity) -> uint64 {
return entity->getRuntimeID().id; return entity->getRuntimeID().rawID;
}); });
RemoteCall::exportAs("GMLIB_API", "getEntityNameTag", [](Actor* entity) -> std::string { RemoteCall::exportAs("GMLIB_API", "getEntityNameTag", [](Actor* entity) -> std::string {
return entity->getNameTag(); return entity->getNameTag();
@@ -730,7 +721,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)->getCurrentValue(); return player->getMutableAttribute(Player::HUNGER())->getCurrentValue();
}); });
RemoteCall::exportAs("GMLIB_API", "getPlayerArmorCoverPercentage", [](Player* player) -> float { RemoteCall::exportAs("GMLIB_API", "getPlayerArmorCoverPercentage", [](Player* player) -> float {
return player->getArmorCoverPercentage(); return player->getArmorCoverPercentage();
@@ -739,7 +730,7 @@ void Export_Compatibility_API() {
return player->getArmorValue(); return player->getArmorValue();
}); });
RemoteCall::exportAs("GMLIB_API", "getEntityOwnerUniqueId", [](Actor* entity) -> int64 { RemoteCall::exportAs("GMLIB_API", "getEntityOwnerUniqueId", [](Actor* entity) -> int64 {
return entity->getOwnerId().id; return entity->getOwnerId().rawID;
}); });
RemoteCall::exportAs("GMLIB_API", "getItemCategoryName", [](ItemStack const* item) -> std::string { RemoteCall::exportAs("GMLIB_API", "getItemCategoryName", [](ItemStack const* item) -> std::string {
return item->getCategoryName(); return item->getCategoryName();
@@ -757,7 +748,7 @@ void Export_Compatibility_API() {
return false; return false;
}); });
RemoteCall::exportAs("GMLIB_API", "setPlayerUIItem", [](Player* player, int slot, ItemStack const* item) -> void { RemoteCall::exportAs("GMLIB_API", "setPlayerUIItem", [](Player* player, int slot, ItemStack const* item) -> void {
player->setPlayerUIItem((PlayerUISlot)slot, *item); player->setPlayerUIItem((PlayerUISlot)slot, *item, false);
}); });
RemoteCall::exportAs("GMLIB_API", "getPlayerUIItem", [](Player* player, int slot) -> ItemStack* { RemoteCall::exportAs("GMLIB_API", "getPlayerUIItem", [](Player* player, int slot) -> ItemStack* {
return const_cast<ItemStack*>(&player->getPlayerUIItem((PlayerUISlot)slot)); return const_cast<ItemStack*>(&player->getPlayerUIItem((PlayerUISlot)slot));
@@ -792,25 +783,25 @@ void Export_Compatibility_API() {
}); });
RemoteCall::exportAs("GMLIB_API", "getEntityEffectDuration", [](Actor* entity, int effectId) -> int { RemoteCall::exportAs("GMLIB_API", "getEntityEffectDuration", [](Actor* entity, int effectId) -> int {
if (auto effect = entity->getEffect(effectId)) { if (auto effect = entity->getEffect(effectId)) {
return effect->mDuration; return effect->mDuration->mValue;
} }
return 0; return 0;
}); });
RemoteCall::exportAs("GMLIB_API", "getEntityEffectDurationEasy", [](Actor* entity, int effectId) -> int { RemoteCall::exportAs("GMLIB_API", "getEntityEffectDurationEasy", [](Actor* entity, int effectId) -> int {
if (auto effect = entity->getEffect(effectId)) { if (auto effect = entity->getEffect(effectId)) {
return effect->mDurationEasy; return effect->mDurationEasy->transform([](auto&& duration) -> int { return duration.mValue; }).value_or(0);
} }
return 0; return 0;
}); });
RemoteCall::exportAs("GMLIB_API", "getEntityEffectDurationHard", [](Actor* entity, int effectId) -> int { RemoteCall::exportAs("GMLIB_API", "getEntityEffectDurationHard", [](Actor* entity, int effectId) -> int {
if (auto effect = entity->getEffect(effectId)) { if (auto effect = entity->getEffect(effectId)) {
return effect->mDurationHard; return effect->mDurationHard->transform([](auto&& duration) -> int { return duration.mValue; }).value_or(0);
} }
return 0; return 0;
}); });
RemoteCall::exportAs("GMLIB_API", "getEntityEffectDurationNormal", [](Actor* entity, int effectId) -> int { RemoteCall::exportAs("GMLIB_API", "getEntityEffectDurationNormal", [](Actor* entity, int effectId) -> int {
if (auto effect = entity->getEffect(effectId)) { if (auto effect = entity->getEffect(effectId)) {
return effect->mDurationNormal; return effect->mDurationNormal->transform([](auto&& duration) -> int { return duration.mValue; }).value_or(0);
} }
return 0; return 0;
}); });
@@ -857,7 +848,13 @@ void Export_Compatibility_API() {
std::vector<Recipes::Type> types; std::vector<Recipes::Type> types;
char rt = 'A'; char rt = 'A';
for (auto& ing : ingredients) { for (auto& ing : ingredients) {
types.emplace_back(ing, rt++, 1, 0); auto ingredient = RecipeIngredient{ing, 0,1};
types.push_back(Recipes::Type{
(Item*)ingredient.getItem(),
ingredient.getBlock(),
ingredient,
rt++
});
} }
GMLIB::Mod::CustomRecipe::registerShapelessCraftingTableRecipe(recipe_id, types, *result); GMLIB::Mod::CustomRecipe::registerShapelessCraftingTableRecipe(recipe_id, types, *result);
} }
@@ -873,9 +870,23 @@ void Export_Compatibility_API() {
std::vector<Recipes::Type> types; std::vector<Recipes::Type> types;
char rt = 'A'; char rt = 'A';
for (auto& ing : ingredients) { for (auto& ing : ingredients) {
types.emplace_back(ing, rt++, 1, 0); auto ingredient = RecipeIngredient{ing, 0, 1};
types.push_back(Recipes::Type{(Item*)ingredient.getItem(), ingredient.getBlock(), ingredient, rt++});
} }
GMLIB::Mod::CustomRecipe::registerShapedCraftingTableRecipe(recipe_id, shape, types, *result); auto tmp = RecipeUnlockingRequirement();
tmp.mContext = RecipeUnlockingRequirement::UnlockingContext::AlwaysUnlocked;
ll::service::bedrock::getLevel()->getRecipes().addShapedRecipe(
recipe_id,
ItemInstance(*result),
shape,
types,
{"crafting_table"},
50,
nullptr,
tmp,
SemVersion(1, 20, 80, "", ""),
true
);
} }
); );
RemoteCall::exportAs("GMLIB_API", "entityIsType", [](Actor* entity, int type) -> bool { RemoteCall::exportAs("GMLIB_API", "entityIsType", [](Actor* entity, int type) -> bool {
+7 -8
View File
@@ -1,12 +1,10 @@
#include "Entry.h" #include "Entry.h"
#include "Global.h" #include "Global.h"
ll::Logger logger(PLUGIN_NAME);
namespace gmlib { namespace gmlib {
std::unique_ptr<LegacyRemoteCallApi>& LegacyRemoteCallApi::getInstance() { LegacyRemoteCallApi& LegacyRemoteCallApi::getInstance() {
static std::unique_ptr<LegacyRemoteCallApi> instance; static LegacyRemoteCallApi instance;
return instance; return instance;
} }
@@ -18,14 +16,15 @@ bool LegacyRemoteCallApi::load() {
Export_Event_API(); Export_Event_API();
Export_BinaryStream_API(); Export_BinaryStream_API();
// Export_Form_API(); // Export_Form_API();
logger.info("GMLIB-LegacyRemoteCallApi Loaded!"); auto logger = ll::io::LoggerRegistry::getInstance().getOrCreate(PLUGIN_NAME);
logger.info( logger->info("GMLIB-LegacyRemoteCallApi Loaded!");
logger->info(
"Loaded Version: {} with {}", "Loaded Version: {} with {}",
fmt::format(fg(fmt::color::pink), "GMLIB-" + GMLIB::Version::getLibVersionString()), fmt::format(fg(fmt::color::pink), "GMLIB-" + GMLIB::Version::getLibVersionString()),
fmt::format(fg(fmt::color::light_green), "GMLIB-LegacyRemoteCallApi-" + LIB_VERSION.asString()) fmt::format(fg(fmt::color::light_green), "GMLIB-LegacyRemoteCallApi-" + LIB_VERSION.asString())
); );
logger.info("Author: GroupMountain"); logger->info("Author: GroupMountain");
logger.info("Repository: https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi"); logger->info("Repository: https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi");
return true; return true;
} }
+2 -3
View File
@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <span>
#include <ll/api/mod/NativeMod.h> #include <ll/api/mod/NativeMod.h>
#include <ll/api/mod/RegisterHelper.h> #include <ll/api/mod/RegisterHelper.h>
@@ -8,9 +7,9 @@ namespace gmlib {
class LegacyRemoteCallApi { class LegacyRemoteCallApi {
public: public:
static std::unique_ptr<LegacyRemoteCallApi>& getInstance(); static LegacyRemoteCallApi& getInstance();
LegacyRemoteCallApi(ll::mod::NativeMod& self) : mSelf(self) {} LegacyRemoteCallApi() : mSelf(*ll::mod::NativeMod::current()) {}
[[nodiscard]] ll::mod::NativeMod& getSelf() const { return mSelf; } [[nodiscard]] ll::mod::NativeMod& getSelf() const { return mSelf; }
+14 -14
View File
@@ -140,7 +140,7 @@ void Export_Event_API() {
(ItemStack * item, std::pair<Vec3, int> position, int64 spawnerUniqueId, bool isCancelled), (ItemStack * item, std::pair<Vec3, int> position, int64 spawnerUniqueId, bool isCancelled),
(&event.getItem(), (&event.getItem(),
{event.getPosition(), event.getBlockSource().getDimensionId().id}, {event.getPosition(), event.getBlockSource().getDimensionId().id},
event.getSpawner().has_value() ? event.getSpawner()->getOrCreateUniqueID().id : -1, event.getSpawner().has_value() ? event.getSpawner()->getOrCreateUniqueID().rawID : -1,
event.isCancelled()), event.isCancelled()),
event.setCancelled(result); event.setCancelled(result);
); );
@@ -151,7 +151,7 @@ void Export_Event_API() {
(Actor * item, std::pair<Vec3, int> position, int64 spawnerUniqueId), (Actor * item, std::pair<Vec3, int> position, int64 spawnerUniqueId),
(&event.self(), (&event.self(),
{event.getPosition(), event.getBlockSource().getDimensionId().id}, {event.getPosition(), event.getBlockSource().getDimensionId().id},
event.getSpawner().has_value() ? event.getSpawner()->getOrCreateUniqueID().id : -1), event.getSpawner().has_value() ? event.getSpawner()->getOrCreateUniqueID().rawID : -1),
, ,
); );
} }
@@ -221,7 +221,7 @@ void Export_Event_API() {
Actor* source = nullptr; Actor* source = nullptr;
if (damageSource.isEntitySource()) { if (damageSource.isEntitySource()) {
auto uniqueId = damageSource.getDamagingEntityUniqueID(); auto uniqueId = damageSource.getDamagingEntityUniqueID();
source = ll::service::getLevel()->fetchEntity(uniqueId); source = ll::service::getLevel()->fetchEntity(uniqueId, false);
if (source->getOwner()) source = source->getOwner(); if (source->getOwner()) source = source->getOwner();
} }
); );
@@ -254,7 +254,7 @@ void Export_Event_API() {
GMLIB::Event::EntityEvent::ProjectileCreateBeforeEvent, GMLIB::Event::EntityEvent::ProjectileCreateBeforeEvent,
(Actor * mob, int64 uniqueId, bool isCancelled), (Actor * mob, int64 uniqueId, bool isCancelled),
(&event.self(), (&event.self(),
event.getShooter() ? event.getShooter()->getOrCreateUniqueID().id : -1, event.getShooter() ? event.getShooter()->getOrCreateUniqueID().rawID : -1,
event.isCancelled()), event.isCancelled()),
event.setCancelled(result); event.setCancelled(result);
); );
@@ -263,7 +263,7 @@ void Export_Event_API() {
REGISTER_EVENT_LISTEN( REGISTER_EVENT_LISTEN(
GMLIB::Event::EntityEvent::ProjectileCreateAfterEvent, GMLIB::Event::EntityEvent::ProjectileCreateAfterEvent,
(Actor * mob, int64 uniqueId), (Actor * mob, int64 uniqueId),
(&event.self(), event.getShooter() ? event.getShooter()->getOrCreateUniqueID().id : -1), (&event.self(), event.getShooter() ? event.getShooter()->getOrCreateUniqueID().rawID : -1),
); );
} }
case doHash("gmlib::SpawnWanderingTraderBeforeEvent"): { case doHash("gmlib::SpawnWanderingTraderBeforeEvent"): {
@@ -299,10 +299,10 @@ void Export_Event_API() {
(Player*)&event.self(), (Player*)&event.self(),
magic_enum::enum_name(requestAction.mActionType).data(), magic_enum::enum_name(requestAction.mActionType).data(),
(int)requestAction.mAmount, (int)requestAction.mAmount,
magic_enum::enum_name(requestAction.mSrc.mOpenContainerNetId).data(), magic_enum::enum_name(requestAction.mSrc->mFullContainerName.mName).data(),
(int)requestAction.mSrc.mSlot, (int)requestAction.mSrc->mSlot,
magic_enum::enum_name(requestAction.mDst.mOpenContainerNetId).data(), magic_enum::enum_name(requestAction.mDst->mFullContainerName.mName).data(),
(int)requestAction.mDst.mSlot, (int)requestAction.mDst->mSlot,
event.isCancelled() event.isCancelled()
), ),
event.setCancelled(result);, event.setCancelled(result);,
@@ -327,10 +327,10 @@ void Export_Event_API() {
(Player*)&event.self(), (Player*)&event.self(),
magic_enum::enum_name(requestAction.mActionType).data(), magic_enum::enum_name(requestAction.mActionType).data(),
(int)requestAction.mAmount, (int)requestAction.mAmount,
magic_enum::enum_name(requestAction.mSrc.mOpenContainerNetId).data(), magic_enum::enum_name(requestAction.mSrc->mFullContainerName.mName).data(),
(int)requestAction.mSrc.mSlot, (int)requestAction.mSrc->mSlot,
magic_enum::enum_name(requestAction.mDst.mOpenContainerNetId).data(), magic_enum::enum_name(requestAction.mDst->mFullContainerName.mName).data(),
(int)requestAction.mDst.mSlot (int)requestAction.mDst->mSlot
), ),
, ,
auto& requestAction = (ItemStackRequestActionTransferBase&)event.getRequestAction(); auto& requestAction = (ItemStackRequestActionTransferBase&)event.getRequestAction();
@@ -342,7 +342,7 @@ void Export_Event_API() {
GMLIB::Event::PacketEvent::ContainerClosePacketSendAfterEvent, GMLIB::Event::PacketEvent::ContainerClosePacketSendAfterEvent,
(Player * player, int containerId, bool serverInitiatedClose, bool), (Player * player, int containerId, bool serverInitiatedClose, bool),
(event.getServerNetworkHandler() (event.getServerNetworkHandler()
.getServerPlayer(event.getNetworkIdentifier(), event.getPacket().mClientSubId), ._getServerPlayer(event.getNetworkIdentifier(), event.getPacket().mClientSubId),
(int)event.getPacket().mContainerId, (int)event.getPacket().mContainerId,
event.getPacket().mServerInitiatedClose, event.getPacket().mServerInitiatedClose,
false), false),
-2
View File
@@ -11,8 +11,6 @@
#define LIB_VERSION GMLIB::Version(LIB_VERSION_MAJOR, LIB_VERSION_MINOR, LIB_VERSION_PATCH) #define LIB_VERSION GMLIB::Version(LIB_VERSION_MAJOR, LIB_VERSION_MINOR, LIB_VERSION_PATCH)
extern ll::Logger logger;
extern void Export_Legacy_GMLib_ModAPI(); extern void Export_Legacy_GMLib_ModAPI();
extern void Export_Legacy_GMLib_ServerAPI(); extern void Export_Legacy_GMLib_ServerAPI();
extern void Export_Compatibility_API(); extern void Export_Compatibility_API();
+3 -3
View File
@@ -149,7 +149,7 @@ void Export_Legacy_GMLib_ModAPI() {
if (set.contains((AllExperiments)experiment_id)) { if (set.contains((AllExperiments)experiment_id)) {
GMLIB_Level::addExperimentsRequire((AllExperiments)experiment_id); GMLIB_Level::addExperimentsRequire((AllExperiments)experiment_id);
} else { } else {
ll::Logger("Server").error("Experiment ID '{}' does not exist!", experiment_id); ll::io::LoggerRegistry::getInstance().getOrCreate("Server")->error("Experiment ID '{}' does not exist!", experiment_id);
} }
}); });
RemoteCall::exportAs("GMLib_ModAPI", "setExperimentEnabled", [](int experiment_id, bool value) -> void { RemoteCall::exportAs("GMLib_ModAPI", "setExperimentEnabled", [](int experiment_id, bool value) -> void {
@@ -158,7 +158,7 @@ void Export_Legacy_GMLib_ModAPI() {
std::unordered_set<AllExperiments> set(list.begin(), list.end()); std::unordered_set<AllExperiments> set(list.begin(), list.end());
if (set.contains((AllExperiments)experiment_id)) { if (set.contains((AllExperiments)experiment_id)) {
GMLIB_Level::getInstance()->setExperimentEnabled(((AllExperiments)experiment_id), value); GMLIB_Level::getInstance()->setExperimentEnabled(((AllExperiments)experiment_id), value);
} else ll::Logger("Server").error("Experiment ID '{}' does not exist!", experiment_id); } else ll::io::LoggerRegistry::getInstance().getOrCreate("Server")->error("Experiment ID '{}' does not exist!", experiment_id);
} }
}); });
RemoteCall::exportAs("GMLib_ModAPI", "getExperimentEnabled", [](int experiment_id) -> bool { RemoteCall::exportAs("GMLib_ModAPI", "getExperimentEnabled", [](int experiment_id) -> bool {
@@ -168,7 +168,7 @@ void Export_Legacy_GMLib_ModAPI() {
if (set.contains((AllExperiments)experiment_id)) { if (set.contains((AllExperiments)experiment_id)) {
return GMLIB_Level::getInstance()->getExperimentEnabled(((AllExperiments)experiment_id)); return GMLIB_Level::getInstance()->getExperimentEnabled(((AllExperiments)experiment_id));
} }
ll::Logger("Server").error("Experiment ID '{}' does not exist!", experiment_id); ll::io::LoggerRegistry::getInstance().getOrCreate("Server")->error("Experiment ID '{}' does not exist!", experiment_id);
} }
return false; return false;
}); });
+1 -1
View File
@@ -4,4 +4,4 @@
#define LL_MEMORY_OPERATORS #define LL_MEMORY_OPERATORS
#include <ll/api/memory/MemoryOperators.h> #include <ll/api/memory/MemoryOperators.h>
+3 -3
View File
@@ -1,7 +1,7 @@
{ {
"format_version": 2, "format_version": 2,
"tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi", "tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi",
"version": "0.13.4", "version": "0.13.5",
"info": { "info": {
"name": "GMLIB-LegacyRemoteCallApi", "name": "GMLIB-LegacyRemoteCallApi",
"description": "Legacy RemoteCall API for GMLIB", "description": "Legacy RemoteCall API for GMLIB",
@@ -14,9 +14,9 @@
"library" "library"
] ]
}, },
"asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.13.4/GMLIB-LegacyRemoteCallApi-windows-x64.zip", "asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.13.5/GMLIB-LegacyRemoteCallApi-windows-x64.zip",
"dependencies": { "dependencies": {
"github.com/GroupMountain/GMLIB": ">=0.13.0" "github.com/GroupMountain/GMLIB": ">=0.13.9"
}, },
"files": { "files": {
"place": [ "place": [
+6 -39
View File
@@ -7,43 +7,12 @@ if not has_config("vs_runtime") then
set_runtimes("MD") set_runtimes("MD")
end end
-- Option 1: Use the latest version of LeviLamina released on GitHub. add_requires("levilamina", {configs = {target_type = "server"}})
add_requires("levilaminalibrary")
add_requires("legacyremotecall") add_requires("legacyremotecall")
add_requires("gmlib") add_requires("gmlib")
add_requires("levibuildscript")
-- Option 2: Use a specific version of LeviLamina released on GitHub. target("GMLIB-LegacyRemoteCallApi")
-- add_requires("levilamina x.x.x")
-- Option 3: Use the latest commit of LeviLamina on GitHub.
-- -- Here, "develop" is the branch name. You can change it to any branch name you want.
-- add_requires("levilamina develop")
-- -- You can also use debug build of LeviLamina.
-- -- add_requires("levilamina develop", {debug = true})
-- package("levilamina")
-- add_urls("https://github.com/LiteLDev/LeviLamina.git")
-- add_deps("ctre 3.8.1")
-- add_deps("entt 3.12.2")
-- add_deps("fmt 10.1.1")
-- add_deps("gsl 4.0.0")
-- add_deps("leveldb 1.23")
-- add_deps("magic_enum 0.9.0")
-- add_deps("nlohmann_json 3.11.2")
-- add_deps("rapidjson 1.1.0")
-- add_deps("pcg_cpp 1.0.0")
-- add_deps("pfr 2.1.1")
-- add_deps("preloader 1.4.0")
-- add_deps("symbolprovider 1.1.0")
-- -- You may need to change this to the target BDS version of your choice.
-- add_deps("bdslibrary 1.20.50.03")
-- on_install(function (package)
-- import("package.tools.xmake").install(package)
-- end)
target("GMLIB-LegacyRemoteCallApi") -- Change this to your plugin name.
add_cxflags( add_cxflags(
"/EHa", "/EHa",
"/utf-8" "/utf-8"
@@ -59,14 +28,12 @@ target("GMLIB-LegacyRemoteCallApi") -- Change this to your plugin name.
"src" "src"
) )
add_packages( add_packages(
"levilaminalibrary", "levilamina",
"legacyremotecall", "legacyremotecall",
"gmlib" "gmlib"
) )
add_shflags( add_rules("@levibuildscript/linkrule")
"/DELAYLOAD:bedrock_server.dll" -- Magic to import symbols from BDS set_exceptions("none")
)
set_exceptions("none") -- To avoid conflicts with /EHa
set_kind("shared") set_kind("shared")
set_languages("c++23") set_languages("c++23")
set_symbols("debug") set_symbols("debug")