private void updateNPCList(int amount, Buffer stream) {
		while (stream.bitPosition + 21 < amount * 8) {
			int npcId = stream.readBits(14);
			if (npcId == 16383)
				break;
			if (npcs[npcId] == null)
				npcs[npcId] = new NPC();
			NPC npc = npcs[npcId];
			npcIds[npcCount++] = npcId;
			npc.lastUpdateTick = tick;
			int y = stream.readBits(5);
			if (y > 15)
				y -= 32;
			int x = stream.readBits(5);
			if (x > 15)
				x -= 32;
			int clearWaypointQueue = stream.readBits(1);
			npc.npcDefinition = EntityDefinition.getDefinition(stream
					.readBits(12));
			int furtherUpdateRequired = stream.readBits(1);
			if (furtherUpdateRequired == 1)
				playersObserved[playersObservedCount++] = npcId;
			npc.boundaryDimension = npc.npcDefinition.boundaryDimension;
			npc.degreesToTurn = npc.npcDefinition.degreesToTurn;
			npc.walkAnimationId = npc.npcDefinition.walkAnimationId;
			npc.turnAboutAnimationId = npc.npcDefinition.turnAboutAnimationId;
			npc.turnRightAnimationId = npc.npcDefinition.turnRightAnimationId;
			npc.turnLeftAnimationId = npc.npcDefinition.turnLeftAnimationId;
			npc.standAnimationId = npc.npcDefinition.standAnimationId;
			npc.setPos(localPlayer.waypointX[0] + x, localPlayer.waypointY[0]
					+ y, clearWaypointQueue == 1);
		}
		stream.finishBitAccess();
	}