diff --git a/.gitignore b/.gitignore index 8632e57..132d2a4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ -cmake-build-debug -cmake-build-release +cmake-build-* version/PDB-1164.txt cvdump.exe PDB导出工具.exe diff --git a/CMakeLists.txt b/CMakeLists.txt index 65a2a4e..31fc89c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,17 +3,16 @@ project(mod) set(CMAKE_CXX_STANDARD 17) #因为ABI原因这个项目只能msvc编译 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - add_compile_options(/wd4828 /wd4819 /EHsc /utf-8) + add_compile_options(/wd4828 /wd4819 /Zi /EHsc /utf-8 /MP) + #set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ") + #set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF") + else () - message(this project don't support GNU gcc or clang, please use MSVC instead) + message(this project don't support GNU gcc, please use MSVC instead) endif () -set(CMAKE_BUILD_TYPE release) +#set(CMAKE_BUILD_TYPE release) set(MOD_API_NAME trapdoor) -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi") -set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF") -set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF") - add_library(${MOD_API_NAME} STATIC api/BDSMod.cpp @@ -42,7 +41,7 @@ add_library(${MOD_API_NAME} STATIC api/tools/ThreadPool.h api/language/I18nManager.cpp api/tools/CastHelper.h - + api/Offset.h ) @@ -131,4 +130,5 @@ target_include_directories( api/language/lang ) -target_link_libraries(${MOD_NAME} ${MOD_API_NAME}) \ No newline at end of file +target_link_libraries(${MOD_NAME} ${MOD_API_NAME}) + diff --git a/api/block/Block.cpp b/api/block/Block.cpp index efccee6..0aea7ff 100644 --- a/api/block/Block.cpp +++ b/api/block/Block.cpp @@ -35,5 +35,9 @@ namespace trapdoor { return offset_cast(this, off::BLOCKACTOR_GET_POSITION); // return reinterpret_cast(reinterpret_cast(this) + 44); } + BlockSource *BlockActor::getBlockSource() { + // TODO + return nullptr; + } } // namespace trapdoor diff --git a/api/block/Block.h b/api/block/Block.h index eb0bcc6..a780523 100644 --- a/api/block/Block.h +++ b/api/block/Block.h @@ -11,7 +11,7 @@ namespace trapdoor { class BlockLegacy; - + class BlockSource; class Block { public: // 获取方块legacy @@ -34,6 +34,8 @@ namespace trapdoor { //获取方块对象 // Block *getBlock(); + //通过方块实体获取方块源 + BlockSource* getBlockSource(); }; struct TickNextTickData { trapdoor::BlockPos pos; diff --git a/make_release.ps1 b/make_release.ps1 new file mode 100644 index 0000000..e69de29 diff --git a/plugins/trapdoor/trapdoor-config.json b/plugins/trapdoor/trapdoor-config.json new file mode 100644 index 0000000..171cc98 --- /dev/null +++ b/plugins/trapdoor/trapdoor-config.json @@ -0,0 +1,129 @@ + + { + "commands": { + "/tick": { + "enable": true, + "permissionLevel": 1 + }, + "/village": { + "enable": true, + "permissionLevel": 0 + }, + "/prof": { + "enable": true, + "permissionLevel": 0 + }, + "/mspt": { + "enable": true, + "permissionLevel": 0 + }, + "/o": { + "enable": true, + "permissionLevel": 1 + }, + "/c": { + "enable": true, + "permissionLevel": 1 + }, + "/s": { + "enable": true, + "permissionLevel": 1 + }, + "/hsa": { + "enable": true, + "permissionLevel": 0 + }, + "/func": { + "enable": true, + "permissionLevel": 1 + }, + "/counter": { + "enable": true, + "permissionLevel": 1 + }, + "/td?": { + "enable": true, + "permissionLevel": 0 + }, + "/os": { + "enable": true, + "permissionLevel": 0 + }, + "/apicfg": { + "enable": true, + "permissionLevel": 1 + }, + "/draw": { + "enable": true, + "permissionLevel": 0 + }, + "/slime": { + "enable": true, + "permissionLevel": 0 + }, + "/backup": { + "enable": true, + "permissionLevel": 1 + }, + "/self": { + "enable": true, + "permissionLevel": 0 + }, + "/cl": { + "enable": true, + "permissionLevel": 0 + }, + "/dev": { + "enable": true, + "permissionLevel": 1 + }, + "/here": { + "enable": true, + "permissionLevel": 0 + }, + "/l": { + "enable": true, + "permissionLevel": 1 + }, + "/lang": { + "enable": true, + "permissionLevel": 1 + }, + "/spawn": { + "enable": true, + "permissionLevel": 0 + }, + "/fakeplayer": { + "enable": true, + "permissionLevel": 1 + }, + "/rs": { + "enable": true, + "permissionLevel": 1 + } + }, + "lowLevelVanillaCommands": [], + "server": { + "levelName": "Bedrock level", + "lang": "zh_cn", + "ws": "ws://127.0.0.1:54321" + }, + "village": { + "bound": "red", + "spawn": "blue", + "poiQuery": "red", + "center": "minecraft:heart_particle" + }, + "functionsEnable": { + "hopperCounter": false, + "spawnHelper": false, + "cactusRotate": false, + "simpleDraw": false, + "playerStat": false + }, + "selfEnable": { + "chunkShow": true, + "distanceMeasure": true, + "redstoneStick": true + } +} diff --git a/plugins/trapdoor/trapdoor.log b/plugins/trapdoor/trapdoor.log new file mode 100644 index 0000000..148300d --- /dev/null +++ b/plugins/trapdoor/trapdoor.log @@ -0,0 +1,80 @@ +[04-15 20:04:18TRAPDOOR INFO](trapdoor::lang::tryChangeLang) set language to en_us +[04-15 20:04:18TRAPDOOR DEBUG](trapdoor::initializeMod) create BDS mod instance +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::initialize) begin read config file plugins/trapdoor/trapdoor-config.json +[04-15 20:04:18TRAPDOOR WARN](mod::ConfigManager::readConfigFile) Can not find config file,trapdoor will generate a defalue one [plugins/trapdoor/trapdoor-config.json] +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readConfigFile) read config file plugins/trapdoor/trapdoor-config.json successfully +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readDevOption) begin read dev options +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) begin read command permission info +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /apicfg enable:1 level:1 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /backup enable:1 level:1 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /c enable:1 level:1 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /cl enable:1 level:0 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /counter enable:1 level:1 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /dev enable:1 level:1 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /draw enable:1 level:0 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /fakeplayer enable:1 level:1 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /func enable:1 level:1 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /here enable:1 level:0 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /hsa enable:1 level:0 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /l enable:1 level:1 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /lang enable:1 level:1 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /mspt enable:1 level:0 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /o enable:1 level:1 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /os enable:1 level:0 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /prof enable:1 level:0 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /rs enable:1 level:1 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /s enable:1 level:1 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /self enable:1 level:0 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /slime enable:1 level:0 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /spawn enable:1 level:0 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /td? enable:1 level:0 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /tick enable:1 level:1 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) - /village enable:1 level:0 +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readCommandConfig) read command permission info successfully +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readLowLevelVanillaCommands) begin read low level vanilla command info +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readLowLevelVanillaCommands) here are the all low level commands: +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readLowLevelVanillaCommands) read low level vanilla commands successfully +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readServerConfig) begin read server info +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readServerConfig) - levelMame : Bedrock level +read server info successfully +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readVillageConfig) begin read village config info +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readVillageConfig) - bound color: red + - spawn color: blue + - poiQueryColor: red + - center:minecraft:heart_particle +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readVillageConfig) read village color successfully +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readFunctionConfig) begin read function config +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readFunctionConfig) read function config successfully +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readSelfConfig) begin read self command config +[04-15 20:04:18TRAPDOOR DEBUG](mod::ConfigManager::readSelfConfig) read self command config successfully +[04-15 20:04:19TRAPDOOR DEBUG](TDHook_51CommandRegistry_registerCommand_8574de98::p) set command Registry 000001D544239950 +[04-15 20:04:19TRAPDOOR DEBUG](trapdoor::BDSMod::setCommandRegistry) set commandRegistry +[04-15 20:04:19TRAPDOOR DEBUG](TDHook_51CommandRegistry_registerCommand_8574de98::p) init commandRegistry +[04-15 20:04:19TRAPDOOR DEBUG](trapdoor::BDSMod::registerCommands) begin register command +[04-15 20:04:19TRAPDOOR DEBUG](trapdoor::CommandManager::registerCmd) register command lang +[04-15 20:04:19TRAPDOOR DEBUG](trapdoor::CommandManager::registerCmd) register command apicfg +[04-15 20:04:19TRAPDOOR DEBUG](trapdoor::CommandManager::registerCmd) register command tick +[04-15 20:04:19TRAPDOOR DEBUG](trapdoor::CommandManager::registerCmd) register command prof +[04-15 20:04:19TRAPDOOR DEBUG](trapdoor::CommandManager::registerCmd) register command mspt +[04-15 20:04:19TRAPDOOR DEBUG](trapdoor::CommandManager::registerCmd) register command backup +[04-15 20:04:19TRAPDOOR DEBUG](trapdoor::CommandManager::registerCmd) register command hsa +[04-15 20:04:19TRAPDOOR DEBUG](trapdoor::CommandManager::registerCmd) register command draw +[04-15 20:04:19TRAPDOOR DEBUG](trapdoor::CommandManager::registerCmd) register command village +[04-15 20:04:19TRAPDOOR DEBUG](trapdoor::CommandManager::registerCmd) register command counter +[04-15 20:04:19TRAPDOOR DEBUG](trapdoor::CommandManager::registerCmd) register command o +[04-15 20:04:19TRAPDOOR DEBUG](trapdoor::CommandManager::registerCmd) register command s +[04-15 20:04:19TRAPDOOR DEBUG](trapdoor::CommandManager::registerCmd) register command c +[04-15 20:04:19TRAPDOOR DEBUG](trapdoor::CommandManager::registerCmd) register command slime +[04-15 20:04:19TRAPDOOR DEBUG](trapdoor::CommandManager::registerCmd) register command func +[04-15 20:04:19TRAPDOOR DEBUG](trapdoor::CommandManager::registerCmd) register command self +[04-15 20:04:19TRAPDOOR DEBUG](trapdoor::CommandManager::registerCmd) register command here +[04-15 20:04:19TRAPDOOR DEBUG](trapdoor::CommandManager::registerCmd) register command l +[04-15 20:04:19TRAPDOOR DEBUG](trapdoor::CommandManager::registerCmd) register command os +[04-15 20:04:19TRAPDOOR DEBUG](trapdoor::CommandManager::registerCmd) register command cl +[04-15 20:04:19TRAPDOOR DEBUG](trapdoor::CommandManager::registerCmd) register command td? +[04-15 20:04:20TRAPDOOR DEBUG](TDHook_248ServerLevel_tick_86efb826::p) init level obj +[04-15 20:04:20TRAPDOOR DEBUG](trapdoor::BDSMod::setLevel) init server level +[04-15 20:04:20TRAPDOOR DEBUG](mod::TrapdoorMod::initialize) mod init +[04-15 20:04:20TRAPDOOR DEBUG](trapdoor::BDSMod::initialize) init thread pool +[04-15 20:04:20TRAPDOOR DEBUG](trapdoor::CommandManager::setCommandConfig) set command permission info +[04-15 20:04:20TRAPDOOR DEBUG](mod::initBackup) create backup folder diff --git a/tools/scripts/build.ps1 b/tools/scripts/build.ps1 index 170e60e..5a2735a 100644 --- a/tools/scripts/build.ps1 +++ b/tools/scripts/build.ps1 @@ -1,4 +1,3 @@ - Set-Location ../../cmake-build-release cmake .. -DCMAKE_BUILD_TYPE=Release cmake --build . --config Release diff --git a/tools/scripts/run.ps1 b/tools/scripts/run.ps1 new file mode 100644 index 0000000..4674a0b --- /dev/null +++ b/tools/scripts/run.ps1 @@ -0,0 +1 @@ +MCDllInject.exe "C:\Users\xhy\Desktop\bedrock-server-1.18.12.01\bedrock_server.exe" ".\bin\Release" \ No newline at end of file diff --git a/trapdoor-disclaimer.md b/trapdoor-disclaimer.md index aec0835..fe67bd6 100644 --- a/trapdoor-disclaimer.md +++ b/trapdoor-disclaimer.md @@ -38,7 +38,7 @@ want to bear such risk, please stop using td plugin. appendix: Here are some suggestions for use: - Update the plug-in to the new version in time, because the td is still a beta version, the more you update it, the - less bugs you can expect + fewer bugs you can expect - Try to turn off unused functions - Timely backup and archive is always a good habit