Skip to content

Commit a1da63d

Browse files
committed
Experiemental Amethyst@1.2.0 testing
1 parent 21ff173 commit a1da63d

3 files changed

Lines changed: 24 additions & 7 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE MOD_VERSION="${MOD_VERSION}")
3939
target_link_libraries(${PROJECT_NAME} PRIVATE ${AMETHYST_API})
4040
target_link_libraries(${PROJECT_NAME} PRIVATE "${AmethystFolder}/lib/fmt.lib")
4141
target_link_libraries(${PROJECT_NAME} PRIVATE "${AmethystFolder}/lib/libMinHook.x64.lib")
42+
target_link_libraries(${PROJECT_NAME} PRIVATE "${AmethystFolder}/lib/libhat.lib")
4243

4344
# Code Style
4445
add_custom_target(ClangFormat

include/dllmain.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#include <amethyst/HookManager.h>
99
#include <amethyst/InputManager.h>
1010
#include <amethyst/Memory.h>
11+
#include <amethyst/events/EventManager.h>
12+
#include <amethyst/events/Event.h>
1113
#include <minecraft/src/common/world/item/ItemStack.h>
1214
#include <minecraft/src/common/world/item/ShulkerBoxBlockItem.h>
1315
#include <minecraft/src/common/world/item/ItemStackBase.h>
@@ -25,6 +27,7 @@
2527
#include <minecraft/src-deps/core/resource/ResourceHelper.h>
2628
#include <minecraft/src-client/common/client/renderer/TexturePtr.h>
2729
#include <minecraft/src-client/common/client/gui/controls/renderers/HoverRenderer.h>
30+
#include <chrono>
2831

2932
#include "ShulkerRenderer.h"
3033

src/dllmain.cpp

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include "dllmain.h"
22

3-
HookManager hookManager;
43
ClientInstance* client;
54

65
ShulkerBoxBlockItem::_appendFormattedHovertext _Shulker_appendFormattedHoverText;
@@ -89,10 +88,25 @@ static void _renderHoverBox(HoverRenderer* self, MinecraftUIRenderContext* ctx,
8988
__renderHoverBox(self, ctx, client, aabb, someFloat);
9089
}
9190

92-
ModFunction void Initialize(const char* gameVersion, InputManager * inputManager) {
91+
void OnStartJoinGame(ClientInstance* ci) {
92+
93+
}
94+
95+
void OnRenderUI(ScreenView* screen, UIRenderContext* ctx) {
96+
97+
}
98+
99+
ModFunction void Initialize(HookManager* hookManager, Amethyst::EventManager* eventManager, InputManager * inputManager) {
93100
MH_Initialize();
94101

95-
hookManager.CreateHook(
102+
hookManager->RegisterFunction(&Item::appendFormattedHovertext, "40 55 53 56 57 41 54 41 55 41 56 41 57 48 8D 6C 24 ? 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 45 ? 49 8B F1 4C 89 44 24 ? 4C 8B F2 48 8B D9");
103+
104+
hookManager->CreateHook(
105+
&Item::appendFormattedHovertext,
106+
&Item_appendFormattedHovertext, reinterpret_cast<void**>(&_Item_appendFormattedHovertext)
107+
);
108+
109+
/*hookManager.CreateHook(
96110
SigScan("40 53 55 56 57 41 56 41 57 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 44 24 ? 4D 8B F9 48 8B DA"),
97111
&Shulker_appendFormattedHovertext, reinterpret_cast<void**>(&_Shulker_appendFormattedHoverText)
98112
);
@@ -105,9 +119,8 @@ ModFunction void Initialize(const char* gameVersion, InputManager * inputManager
105119
hookManager.CreateHook(
106120
SigScan("48 8B C4 48 89 58 ? 48 89 70 ? 48 89 78 ? 4C 89 70 ? 55 48 8D 68 ? 48 81 EC ? ? ? ? 0F 29 70 ? 0F 29 78 ? 44 0F 29 40 ? 49 8B D9"),
107121
&_renderHoverBox, reinterpret_cast<void**>(&__renderHoverBox)
108-
);
109-
}
122+
);*/
110123

111-
ModFunction void Shutdown() {
112-
hookManager.Shutdown();
124+
eventManager->onStartJoinGame.AddListener(OnStartJoinGame);
125+
eventManager->onRenderUI.AddListener(OnRenderUI);
113126
}

0 commit comments

Comments
 (0)