diff --git a/.idea/encodings.xml b/.idea/encodings.xml
index e49f7fa..e88a604 100644
--- a/.idea/encodings.xml
+++ b/.idea/encodings.xml
@@ -2,8 +2,10 @@
+
-
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 0dd5a61..d22c6ff 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,7 +5,7 @@
-
+
@@ -13,41 +13,47 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -61,6 +67,9 @@
+
+
+
@@ -78,18 +87,13 @@
+
+
+
-
-
-
-
-
-
-
-
@@ -111,34 +115,44 @@
-
+
+
+
+
+
+
+
-
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
+
-
+
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b3ec9a0..17b107d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,27 +1,22 @@
cmake_minimum_required(VERSION 3.17)
project(TrapDoor)
-set(CMAKE_CXX_STANDARD 14)
-
+set(CMAKE_CXX_STANDARD 17)
+#set(CMAKE_CXX_FLAGS "/IGNORE:C4819")
include_directories(.)
-
-add_library (TrapDoor SHARED
- entity/Actor.h
- block/Block.h
- common/Common.h
- lib/detours.h
- lib/detver.h
+add_library(TrapDoor SHARED
dllmain.cpp
- lib/framework.h
- lib/mod.cpp
- lib/mod.h
- lib/pch.cpp
- lib/pch.h
- spawn/Spawn.h
- lib/SymHook.h
- Tools.h
- village/Village.h
+ tools/MathTool.cpp
tools/MessageBuilder.cpp
- common/Vec3.h common/BlockPos.h common/AABB.h
- tick/Tick.h
- commands/Shell.cpp commands/Shell.h entity/ActorHook.h tick/TickHook.h tools/MathTool.h tools/Particle.h tools/Message.h village/VillagerHook.h)
+ tools/Particle.cpp
+ tools/Message.cpp
+ lib/pch.cpp
+ lib/mod.cpp
+ village/Village.cpp
+ common/Common.cpp
+ spawn/Spawn.cpp
+ entity/Actor.cpp
+ tick/Tick.cpp
+ commands/Shell.cpp
+ commands/Shell.h
+ block/Block.cpp commands/VanillaCommand.cpp commands/VanillaCommand.h)
diff --git a/Tools.h b/Tools.h
deleted file mode 100644
index 6f70f09..0000000
--- a/Tools.h
+++ /dev/null
@@ -1 +0,0 @@
-#pragma once
diff --git a/block/Block.cpp b/block/Block.cpp
new file mode 100644
index 0000000..ac4bb1d
--- /dev/null
+++ b/block/Block.cpp
@@ -0,0 +1,93 @@
+//
+// Created by xhy on 2020/8/26.
+//
+#include "Block.h"
+#include "tools/Message.h"
+#include "common/Vec3.h"
+#include "common/BlockPos.h"
+#include "tools/MathTool.h"
+
+using namespace SymHook;
+
+namespace block {
+ std::vector posCache;
+}
+
+
+/**
+ * Hook 用铲子右击方块的函数
+ * 老实说这里的功能蛮费的
+ */
+
+THook(
+ void,
+ MSSYM_B2QUA5useOnB1AE10ShovelItemB2AAA4EEBAB1UE14NAEAVItemStackB2AAA9AEAVActorB2AAA9VBlockPosB2AAA4EMMMB1AA1Z,
+ void *a1,
+ void *a2,
+ void *actor,
+ int *blockPos,
+ float a4,
+ float a5,
+ float a6
+) {
+ Vec3 pos(blockPos[0], blockPos[1], blockPos[2]);
+ BlockPos bp(blockPos[0], blockPos[1], blockPos[2]);
+ //printf("%d %d %d\commandMap", blockPos[0], blockPos[1], blockPos[2]);
+ // villageHelper.POIBelong(&bp);
+ if (enableMarkPos) {
+ if (block::posCache.empty()) {
+ block::posCache.emplace_back(pos);
+ block::posCache.emplace_back(pos);
+ } else {
+ block::posCache[0] = block::posCache[1];
+ block::posCache[1] = pos;
+ }
+ if (block::posCache[0] != block::posCache[1]) {
+ gamePrintf("(%d,%d,%d),(%d,%d,%d):%.2f(%.2f),%d(%d)\n",
+ (int) block::posCache[0].x,
+ (int) block::posCache[0].y,
+ (int) block::posCache[0].z,
+ (int) block::posCache[1].x,
+ (int) block::posCache[1].y,
+ (int) block::posCache[1].z,
+ math::distance(block::posCache[0], block::posCache[1], false, true),
+ math::distance(block::posCache[0], block::posCache[1], false, false),
+ (int) math::distance(block::posCache[0], block::posCache[1], true, true),
+ (int) math::distance(block::posCache[0], block::posCache[1], true, false)
+ );
+ std::string str = "minecraft:redstone_wire_dust_particle";
+ }
+ } else {
+ original(a1, a2, actor, blockPos, a4, a5, a6);
+ }
+}
+
+
+
+//海绵放置
+THook(
+ void,
+ MSSYM_B1QA7onPlaceB1AE11SpongeBlockB2AAE20UEBAXAEAVBlockSourceB2AAE12AEBVBlockPosB3AAAA1Z,
+ void *b,
+ void *bs,
+ BlockPos * blockPos
+) {
+ void *block = SYM_CALL(
+ void* (*)(void * , int, int, int),
+ MSSYM_B1QA8getBlockB1AE11BlockSourceB2AAE13QEBAAEBVBlockB2AAA3HHHB1AA1Z, globalBlockSource,
+ blockPos->x, blockPos->y - 1, blockPos->z
+ );
+ if (block) {
+ for (int i = 0; i < 10; i++) {
+ BlockPos p(blockPos->x, blockPos->y + i, blockPos->z);
+ SYM_CALL(
+ void(*)(void * , BlockPos *, void *, int, void *),
+ MSSYM_B1QA8setBlockB1AE11BlockSourceB2AAA4QEAAB1UE13NAEBVBlockPosB2AAA9AEBVBlockB2AAE26HPEBUActorBlockSyncMessageB3AAAA1Z,
+ globalBlockSource, &p, block, 0, nullptr
+ );
+ }
+ } else {
+ gamePrintf("can't get block");
+ }
+
+}
diff --git a/block/Block.h b/block/Block.h
index ff01ad6..22d7adf 100644
--- a/block/Block.h
+++ b/block/Block.h
@@ -1,91 +1,11 @@
#pragma once
#include "common/Common.h"
-#include "lib/pch.h"
#include "lib/mod.h"
#include "lib/SymHook.h"
#include
-using namespace SymHook;
-std::vector cachePosList;
-
-/**
- * Hook 用铲子右击方块的函数
- * 老实说这里的功能蛮费的
- */
-THook(
- void,
- MSSYM_B2QUA5useOnB1AE10ShovelItemB2AAA4EEBAB1UE14NAEAVItemStackB2AAA9AEAVActorB2AAA9VBlockPosB2AAA4EMMMB1AA1Z,
- void *a1,
- void *a2,
- void *actor,
- int *blockPos,
- float a4,
- float a5,
- float a6
-) {
- Vec3 pos(blockPos[0], blockPos[1], blockPos[2]);
- BlockPos bp(blockPos[0], blockPos[1], blockPos[2]);
- //printf("%d %d %d\commandMap", blockPos[0], blockPos[1], blockPos[2]);
- // villageHelper.POIBelong(&bp);
- if (enableMarkPos) {
- if (cachePosList.empty()) {
- cachePosList.emplace_back(pos);
- cachePosList.emplace_back(pos);
- } else {
- cachePosList[0] = cachePosList[1];
- cachePosList[1] = pos;
- }
- if (cachePosList[0] != cachePosList[1]) {
- gamePrintf("(%d,%d,%d),(%d,%d,%d):%.2f(%.2f),%d(%d)\n",
- (int) cachePosList[0].x,
- (int) cachePosList[0].y,
- (int) cachePosList[0].z,
- (int) cachePosList[1].x,
- (int) cachePosList[1].y,
- (int) cachePosList[1].z,
- distance(cachePosList[0], cachePosList[1], false, true),
- distance(cachePosList[0], cachePosList[1], false, false),
- (int) distance(cachePosList[0], cachePosList[1], true, true),
- (int) distance(cachePosList[0], cachePosList[1], true, false)
- );
- std::string str = "minecraft:redstone_wire_dust_particle";
- }
- } else {
- original(a1, a2, actor, blockPos, a4, a5, a6);
- }
-}
-
-
-
-//海绵放置
-THook(
- void,
- MSSYM_B1QA7onPlaceB1AE11SpongeBlockB2AAE20UEBAXAEAVBlockSourceB2AAE12AEBVBlockPosB3AAAA1Z,
- void *b,
- void *bs,
- BlockPos * blockPos
-) {
- void *block = SYM_CALL(
- void* (*)(void * , int, int, int),
- MSSYM_B1QA8getBlockB1AE11BlockSourceB2AAE13QEBAAEBVBlockB2AAA3HHHB1AA1Z, globalBlockSource,
- blockPos->x, blockPos->y - 1, blockPos->z
- );
- if (block) {
- for (int i = 0; i < 10; i++) {
- BlockPos p(blockPos->x, blockPos->y + i, blockPos->z);
- SYM_CALL(
- void(*)(void * , BlockPos*, void *, int, void *),
- MSSYM_B1QA8setBlockB1AE11BlockSourceB2AAA4QEAAB1UE13NAEBVBlockPosB2AAA9AEBVBlockB2AAE26HPEBUActorBlockSyncMessageB3AAAA1Z,
- globalBlockSource, &p, block, 0, nullptr
- );
- }
- } else {
- gamePrintf("can't get block");
- }
-
-}
//这里是红石粉右击事件,暂时关闭了
//THook(
diff --git a/commands/Shell.cpp b/commands/Shell.cpp
index b21b514..1df8431 100644
--- a/commands/Shell.cpp
+++ b/commands/Shell.cpp
@@ -1,9 +1,21 @@
-#pragma warning (disable:4819)
//
-// Created by xhy on 2020/8/24.
+// Created by xhy on 2020/8/26.
//
+#include "lib/mod.h"
+#include "village/Village.h"
+#include