NpcIndexSupplier

fun interface NpcIndexSupplier

NPC index supplier is an interface used to yield NPCs near a player from the server's perspective. This is necessary as the protocol cannot directly communicate with the server, so an interface is needed to provide the indices from the server's end.

Functions

Link copied to clipboard
abstract fun supply(localPlayerIndex: Int, level: Int, x: Int, z: Int, viewDistance: Int): Iterator<Int>

The supply function should yield all npc indices that are in range of the local player and should be rendered to them. It is important to note that the server will be unaware of the indices that are already tracked by a given player's npc info; the npc info protocol is responsible for ignoring NPCs it already tracks in such cases. Additionally, the protocol is responsible for taking as many indices as it can realistically process. This means that the iterator may be left in a partially-consumed state.