Skip to content

Commit

Permalink
repair all bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
hhhxiao committed Aug 27, 2020
1 parent 87a314b commit 488c439
Show file tree
Hide file tree
Showing 42 changed files with 2,170 additions and 1,187 deletions.
4 changes: 3 additions & 1 deletion .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

116 changes: 65 additions & 51 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 16 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
1 change: 0 additions & 1 deletion Tools.h

This file was deleted.

93 changes: 93 additions & 0 deletions block/Block.cpp
Original file line number Diff line number Diff line change
@@ -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<Vec3> 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");
}

}
Loading

0 comments on commit 488c439

Please sign in to comment.