-
-
Notifications
You must be signed in to change notification settings - Fork 20
5. Development en US
xiaohengying edited this page Apr 2, 2021
·
4 revisions
Please install Microsoft Visual Studio 2019
and cmake
Run the following command in the source code root folder(use powershell):
mkdir build
(c)
run cd build
to enter the build
dir then run:
cmake .. -DCMAKE_BUILD_TYPE=Release
Run under the build
index
cmake --build . --config Release
after compilation, trapdoor-mod.dll
will be generated in Release
folder
Only the
Release
version can be used, not theDebug
version
Reference only
This is how the index looks:
├─api //No actual function, mainly ports for BDS under the index
│ ├─block //blocks related ports
│ ├─commands //commands analyse
│ ├─entity //entities ports
│ ├─exexpermental
│ ├─graphics //graphics ports
│ ├─include
│ ├─lib //hook related
│ ├─math
│ ├─tools //tools-related
│ └─world //world-running ports
├─doc
├─img
├─include
├─mod //the implement of functions
│ ├─config //trapdoor-config related
│ ├─function
│ ├─hopper
│ ├─player
│ ├─spawn
│ ├─tick
│ └─village
└─test
- Write a new branch to
trapdoor::BDSMod
class TrapdoorMod : public trapdoor::BDSMod {
}
- Initialise the mod target from
dllmain.cpp
trapdoor::BDSMod *createBDSModInstance() {
return new mod::TrapdoorMod();
}
void mod_init() {
initConsole();
// trapdoor::initLogger("trapdoor.log", false, true, true);
trapdoor::initLogger("trapdoor.log", true, false, false);
auto *mod = createBDSModInstance();
trapdoor::initializeMod(mod);
mod::TrapdoorMod::printCopyRightInfo();
}
- Choose
ServerLevel::tick
inGameTick.cpp
as the target of initializing
THook(
void,
MSSYM_B1QA4tickB1AE11ServerLevelB2AAA7UEAAXXZ,
trapdoor::Level * serverLevel
) {
if (!trapdoor::bdsMod) {
L_ERROR("mod is nullptr");
}
if (!trapdoor::bdsMod->getLevel()) {
trapdoor::bdsMod->setLevel(serverLevel);
trapdoor::bdsMod->asInstance<mod::TrapdoorMod>()->initialize();
}
}
If there is time available, there may ba a change of releasing a more detailed tutorial
Words from the one who translates: Sorry for potential unclear or non-professional wording as I do not have coding related background