Skip to content

Commit

Permalink
支持1.18.12.01
Browse files Browse the repository at this point in the history
  • Loading branch information
hhhxiao committed Feb 21, 2022
1 parent 838d127 commit 4e4960f
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 275 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ target_link_libraries(${MOD_API_NAME} ${PROJECT_SOURCE_DIR}/api/lib/detours.lib)

####################这里是具体功能##########################
set(TRAPDOOR_VERSION 0.10.2)
set(MCBE_VERSION 1.18.2.03)
set(MCBE_VERSION 1.18.12.01)
set(BETA OFF)
set(TEST_NUMBER 1)
add_definitions(-DTD_VERSION="${TRAPDOOR_VERSION}")
Expand Down
8 changes: 4 additions & 4 deletions api/entity/Item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ namespace trapdoor {

using namespace SymHook;
//右键代理类
THook(void, Item_useOn_35e33f80, void *item, trapdoor::ItemStackBase *itemStack,
THook(void, Item_useOn_51392594, void *item, trapdoor::ItemStackBase *itemStack,
trapdoor::Actor *player, int x, int y, int z, unsigned int facing,
float dx, float dy, float dz) {
trapdoor::Vec3 *v) {
uint64_t gameTick = trapdoor::bdsMod->getTrapdoorTick();
// L_INFO("%.2f %.2f %.2f,tick = %llu", x, y, z, gameTick);
trapdoor::RightClickCache targetCache{gameTick, x, y, z};
Expand All @@ -100,10 +100,10 @@ THook(void, Item_useOn_35e33f80, void *item, trapdoor::ItemStackBase *itemStack,
if (playerCache != targetCache) {
//响应右键事件
trapdoor::BlockPos pos(x, y, z);
const trapdoor::Vec3 vec3(dx, dy, dz);
const trapdoor::Vec3 vec3(v->x, v->y, v->z);
trapdoor::bdsMod->useOnHook(player, itemStack->getItemName(), pos,
facing, vec3);
playerCache = targetCache;
}
original(item, itemStack, player, x, y, z, facing, dx, dy, dz);
original(item, itemStack, player, x, y, z, facing, v);
}
105 changes: 53 additions & 52 deletions api/lib/SymHook.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion mod/function/HopperCounter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ namespace mod {
}
std::string stringBuilder;
trapdoor::MessageBuilder builder;
builder.textF("Channel [%d]: Total %d items in %d gt (%.3f min(s))",
builder.textF("Channel [%d]: Total %d items in %d gt (%.3f min(s))\n",
channel, n, gameTick, gameTick / 1200.0);

for (const auto &i : counterList) {
Expand Down
9 changes: 5 additions & 4 deletions mod/spawn/SpawnHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,24 @@ namespace mod {
this->verticalSpawnPositions.clear();
auto dim = player->getDimensionID();
this->dimensionID = dim;
int maxY = dim != 1 ? 255 : 127;
// 1.18后世界高度改了
int maxY = dim != 1 ? 320 : 127;
trapdoor::BlockPos topPos = {pos.x, maxY, pos.z};
do {
findNextSpawnPosition(player->getBlockSource(), &topPos, 41);
// L_INFO("find pos %d %d %d", topPos.x, topPos.y, topPos.z);
if (topPos.y > 0)
if (topPos.y > -64)
this->verticalSpawnPositions.emplace_back(topPos.x, topPos.y,
topPos.z);
} while (topPos.y > 0);
} while (topPos.y > -64);
}

void SpawnHelper::printSpawnProbability(trapdoor::Actor *player,
const trapdoor::BlockPos &pos,
uint32_t bright) const {
if (!this->enable) return;
auto dim = player->getDimensionID();
int maxY = dim != 1 ? 255 : 127;
int maxY = dim != 1 ? 320 : 127;
trapdoor::BlockPos topPos = {pos.x, maxY, pos.z};
bool isSurface = true;
bool hasFound = false;
Expand Down
80 changes: 0 additions & 80 deletions tools/package/pack.py

This file was deleted.

132 changes: 0 additions & 132 deletions tools/package/trapdoor-config.json

This file was deleted.

3 changes: 2 additions & 1 deletion tools/sym/user_sym
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@
?setItem@HopperBlockActor@@UEAAXHAEBVItemStack@@@Z

#物品右键方块
?useOn@Item@@QEBA_NAEAVItemStack@@AEAVActor@@HHHEMMM@Z
#?useOn@Item@@QEBA_NAEAVItemStack@@AEAVActor@@HHHEMMM@Z
?useOn@Item@@QEBA_NAEAVItemStack@@AEAVActor@@HHHEAEBVVec3@@@Z

#获取红石原件
?getBaseComponent@CircuitSceneGraph@@QEAAPEAVBaseCircuitComponent@@AEBVBlockPos@@@Z
Expand Down

0 comments on commit 4e4960f

Please sign in to comment.