From 6c98f4515f52350c5f72912793821f3970e468f5 Mon Sep 17 00:00:00 2001
From: hhhxiao <1417599491@qq.com>
Date: Fri, 22 Jan 2021 12:22:20 +0800
Subject: [PATCH] finish redstone singal source,add func and self config
---
.idea/workspace.xml | 17 +++--------------
api/block/CircuitComponent.cpp | 13 +++----------
mod/TrapdoorMod.cpp | 10 +++++-----
mod/TrapdoorMod.h | 2 +-
mod/config/ConfigManager.h | 2 +-
mod/dllmain.cpp | 2 +-
mod/player/PlayerFunction.cpp | 2 +-
mod/player/PlayerFunction.h | 5 ++++-
8 files changed, 19 insertions(+), 34 deletions(-)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 9d9c329..0bd5e1b 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -14,26 +14,14 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
@@ -122,6 +110,7 @@
+
diff --git a/api/block/CircuitComponent.cpp b/api/block/CircuitComponent.cpp
index a3ca1dd..ea27227 100644
--- a/api/block/CircuitComponent.cpp
+++ b/api/block/CircuitComponent.cpp
@@ -27,7 +27,7 @@ namespace trapdoor {
//打印信号源等信息
void BaseCircuitComponent::basePrint(CircuitSceneGraph *graph, trapdoor::Actor *player) {
MessageBuilder builder;
- builder.text("1Signal: ").num(this->getStrength());
+ builder.text("Signal: ").num(this->getStrength());
auto begin = (uint32_t *) *((uint64_t *) this + 1);
auto end = (uint32_t *) *((uint64_t *) this + 2);
int num = 0;
@@ -40,7 +40,7 @@ namespace trapdoor {
if (comp) {
builder.text("\n - ").pos(pos).text(" <==> ").num(comp->getStrength());
vec3.x = (float) pos.x + 0.5f;
- vec3.y = (float) pos.y + 1.7f;
+ vec3.y = (float) pos.y + 0.7f;
vec3.z = (float) pos.z + 0.5f;
spawnParticle(vec3, particleType, player->getDimensionID());
}
@@ -108,8 +108,7 @@ namespace trapdoor {
using namespace SymHook;
//初始化电路图
-bool temp = false;
-
+//这个函数没用了
THook(
trapdoor::BaseCircuitComponent
*,
@@ -117,11 +116,5 @@ THook(
trapdoor::CircuitSceneGraph *graph,
trapdoor::BlockPos * pos
) {
-
- if (!temp) {
- L_DEBUG("%p", graph);
- temp = true;
- }
-
return original(graph, pos);
}
diff --git a/mod/TrapdoorMod.cpp b/mod/TrapdoorMod.cpp
index 10a66cb..eb92783 100644
--- a/mod/TrapdoorMod.cpp
+++ b/mod/TrapdoorMod.cpp
@@ -245,15 +245,15 @@ namespace mod {
commandManager.registerCmd("self", "玩家个人功能")
->then(ARG("chunk", "区块显示", BOOL, {
- if (!configManager.getSelfEnbaleConfig().enableChunkShow) {
+ if (!configManager.getSelfEnableConfig().enableChunkShow) {
error(player, "该功能已被关闭,请联系服主");
return;
}
this->playerFunctions.setShowChunkAble(player->getNameTag(), holder->getBool());
info(player, "设置你的区块显示为 %d", holder->getBool());
}))
- ->then(ARG("me", "测量", BOOL, {
- if (!configManager.getSelfEnbaleConfig().enableDistanceMeasure) {
+ ->then(ARG("me", "信号源显示", BOOL, {
+ if (!configManager.getSelfEnableConfig().enableDistanceMeasure) {
error(player, "该功能已被关闭,请联系服主");
return;
}
@@ -261,12 +261,12 @@ namespace mod {
info(player, "设置你的测量开启/关闭 %d", holder->getBool());
}))
->then(ARG("rs", "测量", BOOL, {
- if (!configManager.getSelfEnbaleConfig().enableRedstoneStick) {
+ if (!configManager.getSelfEnableConfig().enableRedstoneStick) {
error(player, "该功能已被关闭,请联系服主");
return;
}
this->playerFunctions.setRedstoneHelperAble(player->getNameTag(), holder->getBool());
- info(player, "设置你的信号源提 示开启/关闭 %d", holder->getBool());
+ info(player, "设置你的信号源提示开启/关闭 %d", holder->getBool());
}))
->EXE({ PlayerFunction::printInfo(player); });
diff --git a/mod/TrapdoorMod.h b/mod/TrapdoorMod.h
index fa99839..d0f73e3 100644
--- a/mod/TrapdoorMod.h
+++ b/mod/TrapdoorMod.h
@@ -22,7 +22,7 @@ namespace mod {
struct ModInfo {
const std::string minecraftVersion = "1.16.4.02";
- const std::string modVersion = "trapdoor-0.9.16";
+ const std::string modVersion = "trapdoor-0.9.20";
};
class TrapdoorMod : public trapdoor::BDSMod {
diff --git a/mod/config/ConfigManager.h b/mod/config/ConfigManager.h
index 8cdac8f..4355456 100644
--- a/mod/config/ConfigManager.h
+++ b/mod/config/ConfigManager.h
@@ -91,7 +91,7 @@ namespace mod {
inline const ServerConfig &getServerConfig() const { return this->serverConfig; }
- inline const SelfEnableConfig &getSelfEnbaleConfig() const { return this->selfEnableConfig; }
+ inline const SelfEnableConfig &getSelfEnableConfig() const { return this->selfEnableConfig; }
};
}
diff --git a/mod/dllmain.cpp b/mod/dllmain.cpp
index fd041cf..344942b 100644
--- a/mod/dllmain.cpp
+++ b/mod/dllmain.cpp
@@ -26,7 +26,7 @@ trapdoor::BDSMod *createBDSModInstance() {
void mod_init() {
initConsole();
trapdoor::initLogger("trapdoor.log"); //初始化日志
- trapdoor::setDevMode(true);
+ // trapdoor::setDevMode(true);
mod::TrapdoorMod::printCopyRightInfo(); //打印日志
auto *mod = createBDSModInstance();
mod->asInstance()->readConfigFile("trapdoor-config.json"); //读取配置文件
diff --git a/mod/player/PlayerFunction.cpp b/mod/player/PlayerFunction.cpp
index 9f1116f..e7b5a02 100644
--- a/mod/player/PlayerFunction.cpp
+++ b/mod/player/PlayerFunction.cpp
@@ -75,7 +75,7 @@ namespace mod {
}
void PlayerFunction::printRedstoneInfo(trapdoor::Actor *player, BlockPos &pos) {
- if (!this->enableShowChunk[player->getNameTag()])return;
+ if (!this->enableRedstoneHelper[player->getNameTag()])return;
auto graph = player->getDimension()->getGraph();
auto component = graph->getBaseCircuitComponent(&pos);
if (!component) {
diff --git a/mod/player/PlayerFunction.h b/mod/player/PlayerFunction.h
index 8990bda..c7b665f 100644
--- a/mod/player/PlayerFunction.h
+++ b/mod/player/PlayerFunction.h
@@ -39,7 +39,10 @@ namespace mod {
public:
inline void setShowChunkAble(const std::string &playerName, bool able) { enableShowChunk[playerName] = able; }
- inline void setRedstoneHelperAble(const std::string &playerName, bool able) { enableRedstoneHelper[playerName] = able; }
+
+ inline void
+ setRedstoneHelperAble(const std::string &playerName, bool able) { enableRedstoneHelper[playerName] = able; }
+
MeasureData &getMeasureData(const std::string &playerName) { return playerMeasureData[playerName]; }
void tick();