Skip to content

Commit b16cb30

Browse files
committed
Move to amethyst latest
1 parent 1600686 commit b16cb30

4 files changed

Lines changed: 12 additions & 17 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.12)
22
project(BetterInventory)
3-
set(MOD_VERSION "1.4.0")
3+
set(MOD_VERSION "1.5.0")
44

55
# Define only RelWithDebInfo as the available build configuration
66
set(CMAKE_CONFIGURATION_TYPES "RelWithDebInfo" CACHE STRING "Build configurations" FORCE)

include/dllmain.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55
#include <fstream>
66
#include <chrono>
77
#include <amethyst/Log.h>
8-
#include <amethyst/HookManager.h>
9-
#include <amethyst/InputManager.h>
108
#include <amethyst/Memory.h>
11-
#include <amethyst/events/EventManager.h>
12-
#include <amethyst/events/Event.h>
139
#include <minecraft/src/common/world/item/ItemStack.h>
1410
#include <minecraft/src/common/world/item/ShulkerBoxBlockItem.h>
1511
#include <minecraft/src/common/world/item/ItemStackBase.h>
@@ -29,6 +25,7 @@
2925
#include <minecraft/src-client/common/client/gui/controls/renderers/HoverRenderer.h>
3026
#include <chrono>
3127
#include <amethyst-deps/safetyhook.hpp>
28+
#include <amethyst/runtime/AmethystContext.h>
3229

3330
#include "ShulkerRenderer.h"
3431

src/ShulkerRenderer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,15 @@ void ShulkerRenderer::Render(UIRenderContext* ctx, HoverRenderer* hoverRenderer,
9797
for (int y = 0; y < 3; y++) {
9898
ItemStack* itemStack = &shulkerInventory[index][y * 9 + x];
9999
if (itemStack->mItem == nullptr) continue;
100-
if (itemStack->count == 1) continue;
100+
if (itemStack->mCount == 1) continue;
101101

102102
float top = (y * slotSize) + borderSize + textHeight + panelY;
103103
float bottom = top + 16.f;
104104

105105
float left = (x * slotSize) + borderSize + panelX;
106106
float right = left + 16.f;
107107

108-
std::string text = fmt::format("{}", itemStack->count);
108+
std::string text = fmt::format("{}", itemStack->mCount);
109109
RectangleArea rect = { left, right, top + 7.f, bottom};
110110

111111
ctx->drawDebugText(&rect, &text, &mce::Color::WHITE, 1.0f, ui::Left, &textData, &caretData);

src/dllmain.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ static void Item_appendFormattedHovertext(Item* self, const ItemStackBase& itemS
2020
text.append(fmt::format("\n{}7Durability: {} / {}{}r", "\xc2\xa7", current, max, "\xc2\xa7"));
2121
}
2222

23-
std::string rawNameId;
24-
itemStack.getRawNameId(rawNameId);
23+
std::string rawNameId = itemStack.getRawNameId();
2524

2625
if (rawNameId.find("shulker_box") != std::string::npos) {
2726
// Don't append the id for shulker boxes (makes it too long)
@@ -35,7 +34,6 @@ static void Item_appendFormattedHovertext(Item* self, const ItemStackBase& itemS
3534
int index = 0;
3635

3736
static void Shulker_appendFormattedHovertext(ShulkerBoxBlockItem* self, const ItemStackBase& itemStack, Level& level, std::string& text, uint8_t someBool) {
38-
Log::Info("Shulker appendFormattedHovertext");
3937
// Use the appendFormattedHovertext for regular items, we don't want the list of items
4038
Item_appendFormattedHovertext(self, itemStack, level, text, someBool);
4139

@@ -89,13 +87,13 @@ static void HoverRenderer__renderHoverBox(HoverRenderer* self, MinecraftUIRender
8987
_HoverRenderer__renderHoverBox.thiscall(self, ctx, client, aabb, someFloat);
9088
}
9189

92-
ModFunction void Initialize(HookManager* hookManager, Amethyst::EventManager* eventManager, InputManager * inputManager) {
93-
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);
90+
ModFunction void Initialize(AmethystContext* ctx) {
91+
ctx->mHookManager.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");
92+
ctx->mHookManager.CreateHook(&Item::appendFormattedHovertext, _Item_appendFormattedHoverText, &Item_appendFormattedHovertext);
9593

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);
94+
ctx->mHookManager.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");
95+
ctx->mHookManager.CreateHook(&ShulkerBoxBlockItem::appendFormattedHovertext, _Shulker_appendFormattedHoverText, &Shulker_appendFormattedHovertext);
9896

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);
97+
ctx->mHookManager.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");
98+
ctx->mHookManager.CreateHook(&HoverRenderer::_renderHoverBox, _HoverRenderer__renderHoverBox, &HoverRenderer__renderHoverBox);
10199
}

0 commit comments

Comments
 (0)