From 4551019843d4caaa67be21a2ede44d4930de554a Mon Sep 17 00:00:00 2001 From: FloppyDolphin57 <50063641+FloppyDolphin57@users.noreply.github.com> Date: Mon, 6 Sep 2021 08:34:59 -0400 Subject: [PATCH] Fix .nbt save command, Chest Stealer and Item Rendering (#4500) --- Horion/Module/Modules/ChestStealer.cpp | 2 +- Horion/Module/Modules/HudModule.cpp | 4 ++-- SDK/CInventory.cpp | 2 +- SDK/CInventory.h | 4 +++- SDK/CItem.cpp | 6 +++--- SDK/CItem.h | 4 ++-- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Horion/Module/Modules/ChestStealer.cpp b/Horion/Module/Modules/ChestStealer.cpp index f94b42e76..d00282b88 100644 --- a/Horion/Module/Modules/ChestStealer.cpp +++ b/Horion/Module/Modules/ChestStealer.cpp @@ -30,7 +30,7 @@ void ChestStealer::chestScreenController_tick(C_ChestScreenController* c) { } else { delay++; if (delay > setDelay) { - c->leaveScreen(); + c->tryExit(); delay = 0; } } diff --git a/Horion/Module/Modules/HudModule.cpp b/Horion/Module/Modules/HudModule.cpp index da5a3284d..4607419d2 100644 --- a/Horion/Module/Modules/HudModule.cpp +++ b/Horion/Module/Modules/HudModule.cpp @@ -147,7 +147,7 @@ void HudModule::onPostRender(C_MinecraftUIRenderContext* renderCtx) { } } { // ArmorHUD - /* + if (!(g_Data.getLocalPlayer() == nullptr || !this->displayArmor || !GameData::canUseMoveKeys())) { static float constexpr scale = 1.f; static float constexpr opacity = 0.25f; @@ -167,7 +167,7 @@ void HudModule::onPostRender(C_MinecraftUIRenderContext* renderCtx) { //x += scale * spacing; if (item->isValid()) DrawUtils::drawItem(item, vec2_t(x, y), opacity, scale, item->isEnchanted()); - }*/ + } } { // Keystrokes if (!(g_Data.getLocalPlayer() == nullptr || !this->keystrokes || !GameData::canUseMoveKeys())) { diff --git a/SDK/CInventory.cpp b/SDK/CInventory.cpp index fe37cce2f..26c8f97c3 100644 --- a/SDK/CInventory.cpp +++ b/SDK/CInventory.cpp @@ -27,7 +27,7 @@ bool C_Inventory::isFull() { void C_ContainerScreenController::handleAutoPlace(uintptr_t a1, std::string name, int slot) { using ContainerScreenController__autoPlace = __int64(__fastcall*)(C_ContainerScreenController*, uintptr_t, TextHolder, int); - static ContainerScreenController__autoPlace autoPlaceFunc = reinterpret_cast(FindSignature("40 55 53 56 57 41 54 41 55 41 56 41 57 48 8D 6C 24 ?? 48 81 EC ?? ?? ?? ?? 48 C7 44 24 ?? ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 33 C4 48 89 45 07 4D 8B F9 4D 8B E8")); + static ContainerScreenController__autoPlace autoPlaceFunc = reinterpret_cast(FindSignature("40 55 53 56 57 41 54 41 55 41 56 41 57 48 8D 6C 24 ?? 48 81 EC ?? ?? ?? ?? 48 8B 05 30 ?? ?? ?? ?? ?? C4 48 89 45 ?? 45 8B E1 49 8B F0 44 8B EA 89 54 24 30 4C 8B F1")); TextHolder txt = TextHolder(name); diff --git a/SDK/CInventory.h b/SDK/CInventory.h index 1727bc70c..63f1a28bd 100644 --- a/SDK/CInventory.h +++ b/SDK/CInventory.h @@ -74,6 +74,7 @@ class C_PlayerInventoryProxy { C_Inventory* inventory; //0x00B0 }; +//Im not sure exactly where these unknown's go but the funcs we use work. class C_ContainerScreenController { private: virtual __int64 destructor(); @@ -85,6 +86,7 @@ class C_ContainerScreenController { virtual __int64 onTerminate(void); virtual __int64 onInit(void); virtual __int64 onDelete(void); + virtual __int64 unknown1(); public: virtual bool canExit(void); @@ -94,8 +96,8 @@ class C_ContainerScreenController { virtual __int64 areControllerTabsEnabled(void); virtual __int64 onCreation(void); virtual __int64 logCreationTime(std::string const&, double, double, unsigned char); - virtual __int64 unknown1(); virtual __int64 unknown2(); + virtual __int64 unknown3(); public: virtual __int64 onLeave(void); diff --git a/SDK/CItem.cpp b/SDK/CItem.cpp index b3c974c63..747195d0e 100644 --- a/SDK/CItem.cpp +++ b/SDK/CItem.cpp @@ -7,12 +7,12 @@ C_BaseActorRenderContext::C_BaseActorRenderContext(C_ScreenContext *ScreenCtx, C_ClientInstance *client, MinecraftGame *game) { memset(this, 0, sizeof(C_BaseActorRenderContext)); using BaseActorRenderContext_t = __int64(__fastcall *)(C_BaseActorRenderContext *, C_ScreenContext *, C_ClientInstance *, MinecraftGame *); - static BaseActorRenderContext_t BaseActorRenderContext_constructor = reinterpret_cast(FindSignature("48 89 6C 24 ?? 48 89 74 24 ?? 57 48 83 EC ?? 48 8D 05 ?? ?? ?? ?? 8B EA 48 89 01 48 8B F9 48 8B 71 ?? 48 8B 59 30 48")); + static BaseActorRenderContext_t BaseActorRenderContext_constructor = reinterpret_cast(FindSignature("48 89 5C 24 ?? 48 89 74 24 ?? 48 89 4C 24 08 57 48 83 EC ?? ?? ?? ?? 48 8B F9 48 8D 05 ?? ?? ?? ?? 48 89 ?? 33 F6 48 89 71 08")); BaseActorRenderContext_constructor(this, ScreenCtx, client, game); } void C_ItemRenderer::renderGuiItemNew(C_BaseActorRenderContext *BaseActorRenderCtx, C_ItemStack *item, MinecraftGame *game, float x, float y, float opacity, float scale, bool isEnchanted) { using renderGuiItemNew_t = void(__fastcall *)(C_ItemRenderer *, C_BaseActorRenderContext *, C_ItemStack *, MinecraftGame *, float, float, float, float, float, bool); - static renderGuiItemNew_t renderGuiItemNew = reinterpret_cast(FindSignature("40 53 55 57 41 55 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 84 24 ? ? ? ? 49 8B 40 ? 49 8B D8 48 8B EA 4C 8B E9 48 85 C0")); + static renderGuiItemNew_t renderGuiItemNew = reinterpret_cast(FindSignature("48 8B C4 48 89 58 20 55 56 57 41 54 41 55 41 56 41 57 48 81 EC 00 01 00 00 0F 29 70 B8 ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 33 C4 48 89 84 24 ?? ?? ?? ??")); item->setShowPickUp(false); renderGuiItemNew(this, BaseActorRenderCtx, item, game, x, y, 1, opacity, scale, isEnchanted); } @@ -47,7 +47,7 @@ void C_ItemStack::fromTag(const Tag &tag) { } void C_ItemStack::save(CompoundTag **tag) { using ItemStackBase__saveF = void(__fastcall *)(C_ItemStack *, CompoundTag **); - ItemStackBase__saveF save = reinterpret_cast(FindSignature("48 89 5C 24 ?? 55 56 57 41 54 41 55 41 56 41 57 48 8D 6C 24 ?? 48 81 EC 90 ?? ?? ?? 48 8B F2 48 8B F9 48 89 55 17 4C 8B 79")); + ItemStackBase__saveF save = reinterpret_cast(FindSignature("48 89 5C 24 ?? 55 56 57 41 56 41 57 48 8D 6C 24 C9 48 81 EC ?? ?? ?? ?? 48 8B FA 48 8B F1 48 89 55 0F 45 33 ?? 44 89 7D 97 33 C0")); return save(this, tag); } void C_ItemStack::setUserData(std::unique_ptr tag) { diff --git a/SDK/CItem.h b/SDK/CItem.h index fbd92e271..289024853 100644 --- a/SDK/CItem.h +++ b/SDK/CItem.h @@ -18,7 +18,7 @@ class MinecraftGame; class C_BaseActorRenderContext { private: - char pad_0x0[0x58]; //0x0000 + char pad_0x0[0x60]; //0x0000 public: C_ItemRenderer* renderer; //0x0058 private: @@ -359,7 +359,7 @@ class C_ItemStack { class C_ArmorItem : public C_Item { private: - char pad_0x108[0xB8]; //0x100 + char pad_0x108[0x228 - sizeof(C_Item)]; //0x100 public: int ArmorSlot; //0x1B8