diff options
| author | daoge <3523206925@qq.com> | 2026-03-03 03:04:10 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-03 03:04:10 +0800 |
| commit | b3feddfef372618c8a9d7a0abcaf18cfad866c18 (patch) | |
| tree | 267761c3bb39241ba5c347bfbe2254d06686e287 /Minecraft.World/HopperMenu.cpp | |
| parent | 84c31a2331f7a0ec85b9d438992e244f60e5020f (diff) | |
feat: TU19 (Dec 2014) Features & Content (#155)
* try to resolve merge conflict
* feat: TU19 (Dec 2014) Features & Content (#32)
* December 2014 files
* Working release build
* Fix compilation issues
* Add sound to Windows64Media
* Add DLC content and force Tutorial DLC
* Revert "Add DLC content and force Tutorial DLC"
This reverts commit 97a43994725008e35fceb984d5549df9c8cea470.
* Disable broken light packing
* Disable breakpoint during DLC texture map load
Allows DLC loading but the DLC textures are still broken
* Fix post build not working
* ...
* fix vs2022 build
* fix cmake build
---------
Co-authored-by: Loki <lokirautio@gmail.com>
Diffstat (limited to 'Minecraft.World/HopperMenu.cpp')
| -rw-r--r-- | Minecraft.World/HopperMenu.cpp | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/Minecraft.World/HopperMenu.cpp b/Minecraft.World/HopperMenu.cpp new file mode 100644 index 00000000..afc700c3 --- /dev/null +++ b/Minecraft.World/HopperMenu.cpp @@ -0,0 +1,76 @@ +#include "stdafx.h" +#include "net.minecraft.world.inventory.h" +#include "HopperMenu.h" + +HopperMenu::HopperMenu(shared_ptr<Container> inventory, shared_ptr<Container> hopper) +{ + this->hopper = hopper; + hopper->startOpen(); + int yo = 51; + + for (int x = 0; x < hopper->getContainerSize(); x++) + { + addSlot(new Slot(hopper, x, 44 + x * 18, 20)); + } + + for (int y = 0; y < 3; y++) + { + for (int x = 0; x < 9; x++) + { + addSlot(new Slot(inventory, x + y * 9 + 9, 8 + x * 18, y * 18 + yo)); + } + } + for (int x = 0; x < 9; x++) + { + addSlot(new Slot(inventory, x, 8 + x * 18, 58 + yo)); + } +} + +bool HopperMenu::stillValid(shared_ptr<Player> player) +{ + return hopper->stillValid(player); +} + +shared_ptr<ItemInstance> HopperMenu::quickMoveStack(shared_ptr<Player> player, int slotIndex) +{ + shared_ptr<ItemInstance> clicked = nullptr; + Slot *slot = slots.at(slotIndex); + if (slot != NULL && slot->hasItem()) + { + shared_ptr<ItemInstance> stack = slot->getItem(); + clicked = stack->copy(); + + if (slotIndex < hopper->getContainerSize()) + { + if (!moveItemStackTo(stack, hopper->getContainerSize(), slots.size(), true)) + { + return nullptr; + } + } else { + if (!moveItemStackTo(stack, 0, hopper->getContainerSize(), false)) + { + return nullptr; + } + } + if (stack->count == 0) + { + slot->set(nullptr); + } + else + { + slot->setChanged(); + } + } + return clicked; +} + +void HopperMenu::removed(shared_ptr<Player> player) +{ + AbstractContainerMenu::removed(player); + hopper->stopOpen(); +} + +shared_ptr<Container> HopperMenu::getContainer() +{ + return hopper; +}
\ No newline at end of file |
