diff --git a/BDSpyrunner.vcxproj b/BDSpyrunner.vcxproj
index b89abbee..e64cc241 100644
--- a/BDSpyrunner.vcxproj
+++ b/BDSpyrunner.vcxproj
@@ -123,6 +123,7 @@
+
diff --git a/BDSpyrunner.vcxproj.filters b/BDSpyrunner.vcxproj.filters
index 08f8a6d0..d6029937 100644
--- a/BDSpyrunner.vcxproj.filters
+++ b/BDSpyrunner.vcxproj.filters
@@ -104,6 +104,9 @@
头文件
+
+ 头文件
+
diff --git a/DllMain.cpp b/DllMain.cpp
index a82cb13b..70de2dd7 100644
--- a/DllMain.cpp
+++ b/DllMain.cpp
@@ -166,10 +166,12 @@ static bool EventCallBack(EventCode e, const char* format, Args... args) {
}
#pragma endregion
#pragma region Hook List
-//HOOK(Level_tick, void, "?tick@Level@@UEAAXXZ",
-// Level* _this) {
-// original(_this);
-//}
+/*
+HOOK(Level_tick, void, "?tick@Level@@UEAAXXZ",
+ Level* _this) {
+ original(_this);
+}
+*/
//将Python解释器初始化插入bds主函数
HOOK(BDS_Main, int, "main",
int argc, char* argv[], char* envp[]) {
@@ -202,15 +204,15 @@ HOOK(ServerNetworkHandler_construct, uintptr_t, "??0ServerNetworkHandler@@QEAA@A
}
//Scoreboard的构造函数
HOOK(ServerScoreboard_construct, Scoreboard*, "??0ServerScoreboard@@QEAA@VCommandSoftEnumRegistry@@PEAVLevelStorage@@@Z",
- Scoreboard* _this, uintptr_t a2, uintptr_t a3) {
- return Global::data = original(_this, a2, a3);
+ Scoreboard* _this, uintptr_t a1, uintptr_t a2) {
+ return Global::data = original(_this, a1, a2);
}
//改变设置命令的建立,用于注册命令
HOOK(ChangeSettingCommand_setup, void, "?setup@ChangeSettingCommand@@SAXAEAVCommandRegistry@@@Z",
uintptr_t _this) {
for (auto& [cmd, des] : g_commands) {
SymCall("?registerCommand@CommandRegistry@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEBDW4CommandPermissionLevel@@UCommandFlag@@3@Z",
- _this, &cmd, des.first.c_str(), 0, 0, 0x80);
+ _this, &cmd, des.first.c_str(), 0, 0, 0x80/*CommandFlag*/);
}
original(_this);
}
@@ -221,7 +223,7 @@ HOOK(onServerStarted, void, "?startServerThread@ServerInstance@@QEAAXXZ",
thread(CheckPluginVersion).detach();
original(_this);
}
-//控制台输出,实际上是cout<';
}
- return 0;
+ return false;
}
if (debug) {
Py_BEGIN_CALL;
PyRun_SimpleString(cmd->c_str());
Py_END_CALL;
cout << '>';
- return 0;
+ return false;
}
if (EventCallBack(EventCode::onConsoleInput, "O", ToPyUnicode(*cmd)))
return original(_this, cmd);
- else
- return false;
+ return false;
}
//玩家加入发包
HOOK(onPlayerJoin, void, "?handle@ServerNetworkHandler@@UEAAXAEBVNetworkIdentifier@@AEBVSetLocalPlayerAsInitializedPacket@@@Z",
@@ -793,7 +793,7 @@ HOOK(onBlockExploded, void, "?onExploded@Block@@QEBAXAEAVBlockSource@@AEBVBlockP
))
return original(_this, bs, bp, actor);
}
-//方块侧面放触发,点击牌子触发
+//使用牌子
HOOK(onUseSingBlock, uintptr_t, "?use@SignBlock@@UEBA_NAEAVPlayer@@AEBVBlockPos@@E@Z",
uintptr_t _this, Player* a1, BlockPos* a2) {
BlockSource* bs = a1->getRegion();
diff --git a/README.md b/README.md
index 2c0e1cf0..6df6d1b2 100644
--- a/README.md
+++ b/README.md
@@ -3,8 +3,6 @@
![Downloads](https://img.shields.io/github/downloads/twoone-3/BDSpyrunner/total)
![Release](https://img.shields.io/github/v/release/twoone-3/BDSpyrunner)
![BDS](https://img.shields.io/badge/support--BDS--version-1.17.11.01-blue)
-![Issues](https://img.shields.io/github/issues/twoone-3/BDSpyrunner)
-![Telegram](https://img.shields.io/badge/telegram-BDSpyrunner-blue?&logo=telegram&link=https://t.me/bdspyrunner)
[简体中文](README_ZH.md) | English
# Introduction
@@ -13,10 +11,14 @@ It uses CPython and Detours to connect Python and BDS so that Python can operate
It greatly reduces the threshold for plug-in development and effectively simplifies the cost of plug-in development.
# Usage
1. Download `BDSpyrunner.dll` and `BDSpyrunner.pdb` in `Release` (optional).
-2. Go to https://www.python.org/ftp/python/3.7.9/python-3.7.9-amd64.exe to download and install `Python3.7.9`, remember to check add to `Environment Variables`.
-2. Put the dll into the `./plugins` folder, run BDS, the py folder will be automatically generated, if you see `[BDSpyrunner] x.x.x loaded.`, the pyr has been loaded successfully.
-7. Put the plug-in into `./plugins/py`, run BDS again, you can use it normally.
+2. To install pyr, you need to use [LiteLoader](https://github.com/LiteLDev/LiteLoaderBDS), please make sure you have installed LiteLoader
+3. Go to https://www.python.org/ftp/python/3.7.9/python-3.7.9-amd64.exe to download and install `Python3.7.9`, remember to check add to `Environment Variables`.
+4. Put the dll into the `./plugins` folder, run BDS, the py folder will be automatically generated, if you see `[BDSpyrunner] x.x.x loaded.`, the pyr has been loaded successfully.
+5. Put the plug-in into `./plugins/py`, run BDS again, you can use it normally.
+# Other functions
+* Automatic update: Download the update_pyr.bat in the release and put it in the plugins folder to start the automatic update
# Documents
* [Wiki](https://github.com/twoone-3/BDSpyrunner/wiki/)
# Contact us
-QQ group : 1167270197
+* QQ group : 1167270197
+* Telegram : ![Telegram](https://img.shields.io/badge/telegram-BDSpyrunner-blue?&logo=telegram&link=https://t.me/bdspyrunner)
\ No newline at end of file
diff --git a/README_ZH.md b/README_ZH.md
index 22fc7bc5..a7e3405b 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -3,8 +3,6 @@
![Downloads](https://img.shields.io/github/downloads/twoone-3/BDSpyrunner/total)
![Release](https://img.shields.io/github/v/release/twoone-3/BDSpyrunner)
![BDS](https://img.shields.io/badge/support--BDS--version-1.17.11.01-blue)
-![Issues](https://img.shields.io/github/issues/twoone-3/BDSpyrunner)
-![Telegram](https://img.shields.io/badge/telegram-BDSpyrunner-blue?&logo=telegram&link=https://t.me/bdspyrunner)
简体中文 | [English](README.md)
# 简介
@@ -13,10 +11,14 @@
极大的降低了插件开发门槛,有效简化了插件的开发成本。
# 用法
1. 下载`Release`中的`BDSpyrunner.dll`与`BDSpyrunner.pdb`(可选)
-2. 前往 https://www.python.org/ftp/python/3.7.9/python-3.7.9-amd64.exe 下载安装 `Python3.7.9`,记得勾选添加到`环境变量`
-2. 将dll放入`./plugins`文件夹,运行BDS,会自动生成py文件夹,如果看到`[BDSpyrunner] x.x.x loaded.`,则pyr加载成功了
-7. 将插件放入`./plugins/py`,再次运行BDS,就可以正常使用了
+2. 安装pyr,需要使用[LiteLoader](https://github.com/LiteLDev/LiteLoaderBDS),请确保您已经安装了LiteLoader
+3. 前往 https://www.python.org/ftp/python/3.7.9/python-3.7.9-amd64.exe 下载安装 `Python3.7.9`,记得勾选添加到`环境变量`
+4. 将dll放入`./plugins`文件夹,运行BDS,会自动生成py文件夹,如果看到`[BDSpyrunner] x.x.x loaded.`,则pyr加载成功了
+5. 将插件放入`./plugins/py`,再次运行BDS,就可以正常使用了
+# 其他功能
+* 自动更新:下载release中的update_pyr.bat并放入plugins文件夹即可开启自动更新
# 文档
* [Wiki](https://github.com/twoone-3/BDSpyrunner/wiki/)
# 联系我们
-QQ 群 : 1167270197
+* QQ 群 : 1167270197
+* Telegram : ![Telegram](https://img.shields.io/badge/telegram-BDSpyrunner-blue?&logo=telegram&link=https://t.me/bdspyrunner)
\ No newline at end of file
diff --git a/mod/CPython.h b/mod/CPython.h
new file mode 100644
index 00000000..1847095d
--- /dev/null
+++ b/mod/CPython.h
@@ -0,0 +1,4 @@
+#pragma once
+#pragma comment(lib,"lib/python37.lib")
+#define PY_SSIZE_T_CLEAN
+#include "../include/Python.h"
diff --git a/mod/Entity.h b/mod/Entity.h
index 369f24f7..4a5cb76e 100644
--- a/mod/Entity.h
+++ b/mod/Entity.h
@@ -1,8 +1,6 @@
#pragma once
-#pragma comment(lib,"lib/python37.lib")
#include
-#define PY_SSIZE_T_CLEAN
-#include "../include/Python.h"
+#include "CPython.h"
#include "../mc/Position.h"
#define Py_RETURN_ERROR(str) return PyErr_SetString(PyExc_Exception, str), nullptr
diff --git a/mod/Version.h b/mod/Version.h
index bae3e810..a36e1ce7 100644
--- a/mod/Version.h
+++ b/mod/Version.h
@@ -1,5 +1,5 @@
#pragma once
constexpr unsigned VERSION_1 = 1;
constexpr unsigned VERSION_2 = 7;
-constexpr unsigned VERSION_3 = 9;
-constexpr const char* VERSION_STRING = "v1.7.9";
\ No newline at end of file
+constexpr unsigned VERSION_3 = 10;
+constexpr const char* VERSION_STRING = "v1.7.10";
\ No newline at end of file