diff --git a/src/engine/net/client/msg/ManageNPCMsg.java b/src/engine/net/client/msg/ManageNPCMsg.java index c4898efa..b0c9f5e8 100644 --- a/src/engine/net/client/msg/ManageNPCMsg.java +++ b/src/engine/net/client/msg/ManageNPCMsg.java @@ -27,8 +27,6 @@ import org.pmw.tinylog.Logger; import java.util.ArrayList; import java.util.HashSet; -import java.util.List; -import java.util.stream.Collectors; /** * Order NPC @@ -436,12 +434,13 @@ public class ManageNPCMsg extends ClientNetMsg { writer.put((byte) template.modTable);//EffectItemType } - List itemList = ForgeManager.vendorItemLookup.get(npc); - itemList = itemList.stream().limit(npc.getRank()).collect(Collectors.toList()); + // Sanity check. - writer.putInt(itemList.size()); + ForgeManager.vendorItemLookup.computeIfAbsent(npc, k -> new ArrayList<>()); // Forge lookup - for (Item item : itemList) { + writer.putInt(ForgeManager.vendorItemLookup.get(npc).size()); + + for (Item item : ForgeManager.vendorItemLookup.get(npc)) { writer.put((byte) 0); // ? Unknown45 writer.putInt(item.getObjectType().ordinal());