diff options
| author | AcTh2 <68511655+acth2@users.noreply.github.com> | 2026-03-06 01:00:04 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-06 07:00:04 +0700 |
| commit | 75c4f51218cbaad4565cf042f8ad6ea38ae4355f (patch) | |
| tree | 453f7f10c2e55890f3da1cd299e6e9fff4af1946 /Minecraft.World | |
| parent | eed770b121aa4ce38f002db042d0137c24c6d344 (diff) | |
Close the villager trade gui when he dies (#637)
Diffstat (limited to 'Minecraft.World')
| -rw-r--r-- | Minecraft.World/Villager.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Minecraft.World/Villager.cpp b/Minecraft.World/Villager.cpp index 18ed7178..f2901291 100644 --- a/Minecraft.World/Villager.cpp +++ b/Minecraft.World/Villager.cpp @@ -16,6 +16,7 @@ #include "net.minecraft.world.level.h" #include "..\Minecraft.Client\Textures.h" #include "Villager.h" +#include "AbstractContainerMenu.h" unordered_map<int, pair<int,int> > Villager::MIN_MAX_VALUES; unordered_map<int, pair<int,int> > Villager::MIN_MAX_PRICES; @@ -307,6 +308,18 @@ void Villager::die(DamageSource *source) } } + // Make the gui close if the villager die while trading + if (auto currentTrader = tradingPlayer.lock()) + { + if (currentTrader->containerMenu != nullptr) + { + auto menu = currentTrader->containerMenu; + menu->removed(currentTrader); + } + + tradingPlayer.reset(); + } + AgableMob::die(source); } |
