22
33ClientInstance* client;
44
5- ShulkerBoxBlockItem::_appendFormattedHovertext _Shulker_appendFormattedHoverText;
6- Item::_appendFormattedHovertext _Item_appendFormattedHovertext;
7- HoverRenderer::__renderHoverBox __renderHoverBox;
8-
95ShulkerRenderer shulkerRenderer;
106ItemStack shulkerInventory[SHULKER_CACHE_SIZE][27 ];
117
8+ SafetyHookInline _Item_appendFormattedHoverText;
9+ SafetyHookInline _Shulker_appendFormattedHoverText;
10+ SafetyHookInline _HoverRenderer__renderHoverBox;
11+
1212static void Item_appendFormattedHovertext (Item* self, const ItemStackBase& itemStack, Level& level, std::string& text, uint8_t a5) {
13- _Item_appendFormattedHovertext (self, itemStack, level, text, a5);
14- Item* item = itemStack.mItem ;
13+ _Item_appendFormattedHoverText.call <void , Item*, const ItemStackBase&, Level&, std::string&, uint8_t >(self, itemStack, level, text, a5);
1514
15+ Item* item = itemStack.mItem ;
1616 uint64_t max = item->getMaxDamage ();
1717
1818 if (max != 0 ) {
@@ -35,6 +35,7 @@ static void Item_appendFormattedHovertext(Item* self, const ItemStackBase& itemS
3535int index = 0 ;
3636
3737static void Shulker_appendFormattedHovertext (ShulkerBoxBlockItem* self, const ItemStackBase& itemStack, Level& level, std::string& text, uint8_t someBool) {
38+ Log::Info (" Shulker appendFormattedHovertext" );
3839 // Use the appendFormattedHovertext for regular items, we don't want the list of items
3940 Item_appendFormattedHovertext (self, itemStack, level, text, someBool);
4041
@@ -66,7 +67,7 @@ static void Shulker_appendFormattedHovertext(ShulkerBoxBlockItem* self, const It
6667 }
6768}
6869
69- static void _renderHoverBox (HoverRenderer* self, MinecraftUIRenderContext* ctx, IClientInstance* client, RectangleArea* aabb, float someFloat) {
70+ static void HoverRenderer__renderHoverBox (HoverRenderer* self, MinecraftUIRenderContext* ctx, IClientInstance* client, RectangleArea* aabb, float someFloat) {
7071 // This is really bad code, it is relying on the fact that I have also hooked appendFormattedHovertext for items to append the item identifier
7172 // I have no idea where the currently hovered item is stored in the game! I can't find any references to it, so it might be set in some weird place?
7273
@@ -85,42 +86,16 @@ static void _renderHoverBox(HoverRenderer* self, MinecraftUIRenderContext* ctx,
8586 return ;
8687 }
8788
88- __renderHoverBox (self, ctx, client, aabb, someFloat);
89- }
90-
91- void OnStartJoinGame (ClientInstance* ci) {
92-
93- }
94-
95- void OnRenderUI (ScreenView* screen, UIRenderContext* ctx) {
96-
89+ _HoverRenderer__renderHoverBox.thiscall (self, ctx, client, aabb, someFloat);
9790}
9891
9992ModFunction void Initialize (HookManager* hookManager, Amethyst::EventManager* eventManager, InputManager * inputManager) {
100- MH_Initialize ();
101-
10293 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" );
94+ hookManager->CreateHook (&Item::appendFormattedHovertext, _Item_appendFormattedHoverText, &Item_appendFormattedHovertext);
10395
104- hookManager->CreateHook (
105- &Item::appendFormattedHovertext,
106- &Item_appendFormattedHovertext, reinterpret_cast <void **>(&_Item_appendFormattedHovertext)
107- );
108-
109- /* hookManager.CreateHook(
110- 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"),
111- &Shulker_appendFormattedHovertext, reinterpret_cast<void**>(&_Shulker_appendFormattedHoverText)
112- );
113-
114- hookManager.CreateHook(
115- SigScan("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"),
116- &Item_appendFormattedHovertext, reinterpret_cast<void**>(&_Item_appendFormattedHovertext)
117- );
118-
119- hookManager.CreateHook(
120- 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"),
121- &_renderHoverBox, reinterpret_cast<void**>(&__renderHoverBox)
122- );*/
96+ hookManager->RegisterFunction (&ShulkerBoxBlockItem::appendFormattedHovertext, " 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" );
97+ hookManager->CreateHook (&ShulkerBoxBlockItem::appendFormattedHovertext, _Shulker_appendFormattedHoverText, &Shulker_appendFormattedHovertext);
12398
124- eventManager-> onStartJoinGame . AddListener (OnStartJoinGame );
125- eventManager-> onRenderUI . AddListener (OnRenderUI );
99+ hookManager-> RegisterFunction (&HoverRenderer::_renderHoverBox, " 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 " );
100+ hookManager-> CreateHook (&HoverRenderer::_renderHoverBox, _HoverRenderer__renderHoverBox, &HoverRenderer__renderHoverBox );
126101}
0 commit comments