-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: hopper counter can not work in non-overworld
- Loading branch information
Showing
4 changed files
with
90 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,6 @@ version/* | |
venv/ | ||
log/ | ||
/vsbuild | ||
/sym | ||
/sym | ||
cmake-build-relwithdebinfo/ | ||
tools/sym |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,58 @@ | ||
// | ||
// Created by xhy on 2020/8/26. | ||
// | ||
#include <vector> | ||
#include "Block.h" | ||
#include "tools/Message.h" | ||
#include "lib/mod.h" | ||
#include "lib/SymHook.h" | ||
#include "Offset.h" | ||
#include "block/BlockLegacy.h" | ||
#include "tools/DirtyLogger.h" | ||
#include "lib/SymHook.h" | ||
#include "lib/mod.h" | ||
#include "tools/CastHelper.h" | ||
#include "Offset.h" | ||
#include "tools/DirtyLogger.h" | ||
#include "tools/Message.h" | ||
#include <vector> | ||
|
||
namespace trapdoor { | ||
using namespace SymHook; | ||
|
||
//获取方块legacy | ||
BlockLegacy *Block::getLegacy() { | ||
return SYM_CALL( | ||
BlockLegacy * (*)(Block * block), | ||
MSSYM_B1QE14getLegacyBlockB1AA5BlockB2AAE19QEBAAEBVBlockLegacyB2AAA2XZ, | ||
this | ||
); | ||
} | ||
|
||
//获取方块名字 | ||
std::string Block::getName() { | ||
std::string debugStr; | ||
SYM_CALL( | ||
void(*)(void * block, std::string &), | ||
MSSYM_B1QE13toDebugStringB1AA5BlockB2AAA4QEBAB1QA2AVB2QDA5basicB1UA6stringB1AA2DUB2QDA4charB1UA6traitsB1AA1DB1AA3stdB2AAA1VB2QDA9allocatorB1AA1DB1AA12B2AAA3stdB2AAA2XZ, | ||
this, debugStr); | ||
//remove "name: " | ||
return debugStr.erase(0, 6); | ||
} | ||
|
||
//是否是空气 | ||
bool Block::isAir() { | ||
return this->getLegacy()->getBlockID() == AIR; | ||
} | ||
|
||
//获取特殊值 | ||
int Block::getVariant() { | ||
|
||
return *offset_cast<char *>(this, off::BLOCK_GET_VARIANT); | ||
} | ||
|
||
//获取方块实体的位置 | ||
BlockPos *BlockActor::getPosition() { | ||
return offset_cast<BlockPos *>(this, off::BLOCKSOURCE_GET_POSITION); | ||
//return reinterpret_cast<BlockPos *>(reinterpret_cast<VA>(this) + 44); | ||
} | ||
using namespace SymHook; | ||
|
||
//获取方块legacy | ||
BlockLegacy *Block::getLegacy() { | ||
return SYM_CALL( | ||
BlockLegacy * (*)(Block * block), | ||
MSSYM_B1QE14getLegacyBlockB1AA5BlockB2AAE19QEBAAEBVBlockLegacyB2AAA2XZ, | ||
this); | ||
} | ||
|
||
//获取方块名字 | ||
std::string Block::getName() { | ||
std::string debugStr; | ||
SYM_CALL( | ||
void (*)(void *block, std::string &), | ||
MSSYM_B1QE13toDebugStringB1AA5BlockB2AAA4QEBAB1QA2AVB2QDA5basicB1UA6stringB1AA2DUB2QDA4charB1UA6traitsB1AA1DB1AA3stdB2AAA1VB2QDA9allocatorB1AA1DB1AA12B2AAA3stdB2AAA2XZ, | ||
this, debugStr); | ||
// remove "name: " | ||
return debugStr.erase(0, 6); | ||
} | ||
|
||
//是否是空气 | ||
bool Block::isAir() { return this->getLegacy()->getBlockID() == AIR; } | ||
|
||
//获取特殊值 | ||
int Block::getVariant() { | ||
|
||
return *offset_cast<char *>(this, off::BLOCK_GET_VARIANT); | ||
} | ||
|
||
Block *BlockActor::getBlock() { | ||
//*(this + 2) | ||
// return nullptr; | ||
return *reinterpret_cast<Block **>(reinterpret_cast<VA>(this) + 16); | ||
// return (Block *)*((char *)this + 2); | ||
} | ||
|
||
//获取方块实体的位置 | ||
BlockPos *BlockActor::getPosition() { | ||
return offset_cast<BlockPos *>(this, off::BLOCKSOURCE_GET_POSITION); | ||
// return reinterpret_cast<BlockPos *>(reinterpret_cast<VA>(this) + 44); | ||
} | ||
|
||
} // namespace trapdoor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,49 @@ | ||
#pragma once | ||
|
||
#include "lib/mod.h" | ||
#include "lib/SymHook.h" | ||
#include "graphics/BlockPos.h" | ||
#include "BlockLegacy.h" | ||
#include "graphics/BlockPos.h" | ||
#include "lib/SymHook.h" | ||
#include "lib/mod.h" | ||
#include <vector> | ||
|
||
struct Biome; | ||
|
||
struct Biome; | ||
|
||
namespace trapdoor { | ||
|
||
/* | ||
* 方块接口 | ||
* | ||
*/ | ||
class BlockLegacy; | ||
|
||
class Block { | ||
public: | ||
// 获取方块legacy | ||
BlockLegacy *getLegacy(); | ||
class BlockLegacy; | ||
|
||
//获取方块名称(和item返回的名称不一样,不知道Mojang怎么想的) | ||
std::string getName(); | ||
class Block { | ||
public: | ||
// 获取方块legacy | ||
BlockLegacy *getLegacy(); | ||
|
||
//获取特殊值 | ||
int getVariant(); | ||
//获取方块名称(和item返回的名称不一样,不知道Mojang怎么想的) | ||
std::string getName(); | ||
|
||
//是否是空气 | ||
bool isAir(); | ||
}; | ||
//获取特殊值 | ||
int getVariant(); | ||
|
||
//是否是空气 | ||
bool isAir(); | ||
}; | ||
|
||
/* | ||
* 方块实体接口 | ||
*/ | ||
class BlockActor { | ||
public: | ||
//获取位置 | ||
BlockPos *getPosition(); | ||
class BlockActor { | ||
public: | ||
//获取位置 | ||
BlockPos *getPosition(); | ||
|
||
//获取方块对象 | ||
// Block *getBlock(); | ||
}; | ||
//获取方块对象 | ||
Block *getBlock(); | ||
}; | ||
|
||
} | ||
} // namespace trapdoor | ||
typedef trapdoor::Block Block; | ||
typedef trapdoor::BlockActor BlockActor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters