aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/MerchantMenu.h
diff options
context:
space:
mode:
authordaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
committerdaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
commitb691c43c44ff180d10e7d4a9afc83b98551ff586 (patch)
tree3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.World/MerchantMenu.h
parentdef8cb415354ac390b7e89052a50605285f1aca9 (diff)
Initial commit
Diffstat (limited to 'Minecraft.World/MerchantMenu.h')
-rw-r--r--Minecraft.World/MerchantMenu.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/Minecraft.World/MerchantMenu.h b/Minecraft.World/MerchantMenu.h
new file mode 100644
index 00000000..14a5fa1d
--- /dev/null
+++ b/Minecraft.World/MerchantMenu.h
@@ -0,0 +1,46 @@
+#pragma once
+
+#include "AbstractContainerMenu.h"
+
+class MerchantContainer;
+
+class MerchantMenu : public AbstractContainerMenu
+{
+public:
+ static const int PAYMENT1_SLOT = 0;
+ static const int PAYMENT2_SLOT = 1;
+ static const int RESULT_SLOT = 2;
+
+ static const int INV_SLOT_START = RESULT_SLOT + 1;
+ static const int INV_SLOT_END = INV_SLOT_START + 9 * 3;
+ static const int USE_ROW_SLOT_START = INV_SLOT_END;
+ static const int USE_ROW_SLOT_END = USE_ROW_SLOT_START + 9;
+
+ static const int SELLSLOT1_X = 36;
+ static const int SELLSLOT2_X = SELLSLOT1_X + 26;
+ static const int BUYSLOT_X = 120;
+
+ static const int ROW1_Y = 24;
+ static const int ROW2_Y = 53;
+
+
+private:
+ shared_ptr<Merchant> trader;
+ shared_ptr<MerchantContainer> tradeContainer;
+ Level *level;
+
+public:
+ MerchantMenu(shared_ptr<Inventory> inventory, shared_ptr<Merchant> merchant, Level *level);
+
+ shared_ptr<MerchantContainer> getTradeContainer();
+ void addSlotListener(ContainerListener *listener);
+ void broadcastChanges();
+ void slotsChanged(); // 4J used to take a shared_ptr<Container> but wasn't using it, so removed to simplify things
+ void setSelectionHint(int hint);
+ void setData(int id, int value);
+ bool stillValid(shared_ptr<Player> player);
+ shared_ptr<ItemInstance> quickMoveStack(shared_ptr<Player> player, int slotIndex);
+ void removed(shared_ptr<Player> player);
+
+ shared_ptr<Merchant> getMerchant(); // 4J Added
+}; \ No newline at end of file