#1525: Implement Server#createMerchant; Fix MerchantView opening inconsistency
This commit is contained in:
parent
a0e06dfa0c
commit
76fd7c056d
@ -2080,6 +2080,11 @@ public final class CraftServer implements Server {
|
|||||||
return new CraftMerchantCustom(title == null ? InventoryType.MERCHANT.getDefaultTitle() : title);
|
return new CraftMerchantCustom(title == null ? InventoryType.MERCHANT.getDefaultTitle() : title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Merchant createMerchant() {
|
||||||
|
return new CraftMerchantCustom(""); // if opened with the old methods title won't render, but will be empty.
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxChainedNeighborUpdates() {
|
public int getMaxChainedNeighborUpdates() {
|
||||||
return this.getServer().getMaxChainedNeighborUpdates();
|
return this.getServer().getMaxChainedNeighborUpdates();
|
||||||
|
@ -58,6 +58,11 @@ public final class CraftMenus {
|
|||||||
if (minecraftMerchant instanceof EntityVillager villager) {
|
if (minecraftMerchant instanceof EntityVillager villager) {
|
||||||
level = villager.getVillagerData().getLevel();
|
level = villager.getVillagerData().getLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (minecraftMerchant.getTradingPlayer() != null) { // merchant's can only have one trader
|
||||||
|
minecraftMerchant.getTradingPlayer().closeContainer();
|
||||||
|
}
|
||||||
|
|
||||||
minecraftMerchant.setTradingPlayer(player);
|
minecraftMerchant.setTradingPlayer(player);
|
||||||
|
|
||||||
player.connection.send(new PacketPlayOutOpenWindow(merchant.containerId, Containers.MERCHANT, merchant.getTitle()));
|
player.connection.send(new PacketPlayOutOpenWindow(merchant.containerId, Containers.MERCHANT, merchant.getTitle()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user