mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-11-23 07:16:39 +01:00
Use the inventory name always for villager inventories
Testing not crashing on 1.8 and 1.13.2.
This commit is contained in:
parent
9788ed4dc6
commit
ab9501da69
1 changed files with 2 additions and 12 deletions
|
@ -31,12 +31,11 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerTrade
|
|||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import com.nukkitx.nbt.NbtType;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
||||
import com.nukkitx.protocol.bedrock.packet.UpdateTradePacket;
|
||||
import org.geysermc.connector.entity.Entity;
|
||||
import org.geysermc.connector.entity.type.EntityType;
|
||||
import org.geysermc.connector.inventory.Inventory;
|
||||
import org.geysermc.connector.inventory.MerchantContainer;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
|
@ -71,16 +70,7 @@ public class JavaTradeListTranslator extends PacketTranslator<ServerTradeListPac
|
|||
updateTradePacket.setTradeTier(packet.getVillagerLevel() - 1);
|
||||
updateTradePacket.setContainerId((short) packet.getWindowId());
|
||||
updateTradePacket.setContainerType(ContainerType.TRADE);
|
||||
String displayName;
|
||||
//TODO: verify correct window title behavior
|
||||
Entity realVillager = session.getEntityCache().getEntityByGeyserId(session.getLastInteractedVillagerEid());
|
||||
if (realVillager != null && realVillager.getMetadata().containsKey(EntityData.NAMETAG) && realVillager.getMetadata().getString(EntityData.NAMETAG) != null) {
|
||||
displayName = realVillager.getMetadata().getString(EntityData.NAMETAG);
|
||||
} else {
|
||||
displayName = realVillager != null &&
|
||||
realVillager.getEntityType() == EntityType.WANDERING_TRADER ? "Wandering Trader" : "Villager";
|
||||
}
|
||||
updateTradePacket.setDisplayName(displayName);
|
||||
updateTradePacket.setDisplayName(openInventory.getTitle());
|
||||
updateTradePacket.setSize(0);
|
||||
updateTradePacket.setNewTradingUi(true);
|
||||
updateTradePacket.setUsingEconomyTrade(true);
|
||||
|
|
Loading…
Reference in a new issue