Close the villager trade gui when he dies (#637)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user